cloudsearch2 add document issue?

104 views
Skip to first unread message

Sai Asuka

unread,
Apr 2, 2015, 6:12:48 AM4/2/15
to boto-...@googlegroups.com
When attempting to add a document using a cloudsearch2 connection using the sample in the boto docs, I get a:

TypeError: add() takes exactly 3 arguments (4 given)

What gives?

Adrian Klaver

unread,
Apr 2, 2015, 10:38:04 AM4/2/15
to boto-...@googlegroups.com
On 04/01/2015 09:26 PM, Sai Asuka wrote:
> When attempting to add a document using a cloudsearch2 connection using
> the sample in the boto docs, I get a:

What example? The only one I can find is for cloudsearch and you say you
are using cloudsearch2. The add() signatures are different:

cloudsearch:

add(_id, version, fields, lang='en')

cloudsearch2:

add(_id, fields)

>
> TypeError: add() takes exactly 3 arguments (4 given)
>
> What gives?

See above.

>

--
Adrian Klaver
adrian...@aklaver.com

Sai Asuka

unread,
Apr 2, 2015, 11:41:36 AM4/2/15
to boto-...@googlegroups.com
This was the example I was following: http://boto.readthedocs.org/en/latest/cloudsearch_tut.html

I tried that new signature as follows:

doc_service.add(user['id'], user)
doc_service.commit();

But then I get this errror when I attempt to commit:
boto.cloudsearch2.document.CommitMismatchError: Incorrect number of adds returned. Commit: 1 Response: 0

What is going on?

Adrian Klaver

unread,
Apr 2, 2015, 2:04:59 PM4/2/15
to boto-...@googlegroups.com
On 04/02/2015 08:41 AM, Sai Asuka wrote:
> This was the example I was
> following: http://boto.readthedocs.org/en/latest/cloudsearch_tut.html
>
> I tried that new signature as follows:
>
> doc_service.add(user['id'], user)
> doc_service.commit();
>
> But then I get this errror when I attempt to commit:
> boto.cloudsearch2.document.CommitMismatchError: Incorrect number of adds
> returned. Commit: 1 Response: 0
>
> What is going on?

Don't know, it seems the response is saying the commit did not happen.

If it where me I would use cloudsearch instead of cloudsearch2 and go
through the example to learn the ropes.

>
> On Thursday, April 2, 2015 at 10:38:04 AM UTC-4, Adrian Klaver wrote:
>
> On 04/01/2015 09:26 PM, Sai Asuka wrote:
> > When attempting to add a document using a cloudsearch2 connection
> using
> > the sample in the boto docs, I get a:
>
> What example? The only one I can find is for cloudsearch and you say
> you
> are using cloudsearch2. The add() signatures are different:
>
> cloudsearch:
>
> add(_id, version, fields, lang='en')
>
> cloudsearch2:
>
> add(_id, fields)
>
> >
> > TypeError: add() takes exactly 3 arguments (4 given)
> >
> > What gives?
>
> See above.
>
> >
>
> --
> Adrian Klaver
> adrian...@aklaver.com <javascript:>
>
> --
> You received this message because you are subscribed to the Google
> Groups "boto-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to boto-users+...@googlegroups.com
> <mailto:boto-users+...@googlegroups.com>.
> To post to this group, send email to boto-...@googlegroups.com
> <mailto:boto-...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/boto-users.
> For more options, visit https://groups.google.com/d/optout.


--
Adrian Klaver
adrian...@aklaver.com

Sai Asuka

unread,
Apr 2, 2015, 5:40:51 PM4/2/15
to boto-...@googlegroups.com
The only reason I used cloudsearch2 is that cloudsearch 1 was giving me random unauthorized errors despite setting up cloudsearch with the ability to access everything. Even a simple list/describe of the tables would not work in cloudsearch 1. When I used cloudsearch2, I was able to get a list/describe of the tables and no more random XML errors so I figured it has something to do with the "Cloudsearch 2013 API?) 

If there is some way to get it to work with cloudsearch 1, let me know, but from what I've seen it looks like cloudsearch2 is the way to go? At the very least I am not getting problems even using cloudsearch (except for actually adding documents with it).

Given cloudsearch2 works in my current situation, is there something else I need to do to get it to work with cloudsearch1?
Or even better, if cloudsearch2 is supposed to work.. how do I commit/add documents correctly? Or is it just a major bug that no one cares about?

Adrian Klaver

unread,
Apr 2, 2015, 5:59:45 PM4/2/15
to boto-...@googlegroups.com
On 04/02/2015 02:40 PM, Sai Asuka wrote:
> The only reason I used cloudsearch2 is that cloudsearch 1 was giving me
> random unauthorized errors despite setting up cloudsearch with the
> ability to access everything. Even a simple list/describe of the tables
> would not work in cloudsearch 1. When I used cloudsearch2, I was able to
> get a list/describe of the tables and no more random XML errors so I
> figured it has something to do with the "Cloudsearch 2013 API?)
>
> If there is some way to get it to work with cloudsearch 1, let me know,
> but from what I've seen it looks like cloudsearch2 is the way to go? At
> the very least I am not getting problems even using cloudsearch (except
> for actually adding documents with it).
>
> Given cloudsearch2 works in my current situation, is there something
> else I need to do to get it to work with cloudsearch1?
> Or even better, if cloudsearch2 is supposed to work.. how do I
> commit/add documents correctly? Or is it just a major bug that no one
> cares about?

I do not use cloudsearch in either form, so I am probably not the best
person to ask. I just noticed the discrepancy in versions. To get an
answer I would post a minimal complete code example with errors. Pretty
sure that cloudsearch and cloudsearch2 are named different for a reason,
probably that there is difference in how they operate. Without seeing
how you got to add() it is difficult to troubleshoot any deeper.

>
>
>


--
Adrian Klaver
adrian...@aklaver.com

Sai Asuka

unread,
Apr 3, 2015, 1:31:07 PM4/3/15
to boto-...@googlegroups.com
Snappet here:

    {
        'id': 1,
        'username': 'dan',
        'last_activity': 1334252740,
        'follower_count': 20,
        'location': 'USA',
        'snippet': 'Dan likes watching sunsets and rock climbing',
    }
doc_service = domain.get_document_service()
for user in users:
   doc_service.add(user['id'], user)
doc_service.commit()

Can't get any simpler than that.

Adrian Klaver

unread,
Apr 3, 2015, 2:33:07 PM4/3/15
to boto-...@googlegroups.com
On 04/03/2015 10:31 AM, Sai Asuka wrote:
> Snappet here:
>
> {
> 'id': 1,
> 'username': 'dan',
> 'last_activity': 1334252740,
> 'follower_count': 20,
> 'location': 'USA',
> 'snippet': 'Dan likes watching sunsets and rock climbing',
> }
> doc_service = domain.get_document_service()
> for user in users:
> doc_service.add(user['id'], user)
> doc_service.commit()
>
> Can't get any simpler than that.

That is the problem, it is not a complete code example. No indication of
what cloudsearch you are using cloudsearch or cloudsearch2. No
indication of where users comes from. Also no error messages or
indication that the above completed. If you want an answer, you need to
quit assuming that the folks on this list can see what is happening on
your machine. So again please, a complete example with imports and all
assignments. Also what you expected and what happened.

>



--
Adrian Klaver
adrian...@aklaver.com
Reply all
Reply to author
Forward
0 new messages