Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bulk_index doesn't work with ES 0.17.9 #59

Closed
willkg opened this issue Jan 23, 2013 · 1 comment
Closed

bulk_index doesn't work with ES 0.17.9 #59

willkg opened this issue Jan 23, 2013 · 1 comment

Comments

@willkg
Copy link
Contributor

willkg commented Jan 23, 2013

http://www.elasticsearch.org/guide/reference/api/bulk.html

That says the endpoints for _bulk are:

  • /_bulk
  • /{index}/_bulk
  • /{index}/{type}/_bulk

pyelasticsearch has a bulk_index method on ElasticSearch which takes an index and a doc_type, puts both of them into the action of the request body, and then uses the middle endpoint /{index}/_bulk.

That works with 0.19.11 (and probably later--I haven't sat down and tested much), but fails with 0.17.9 with this:

requests.packages.urllib3.connectionpool: DEBUG: "POST /inputindex/_bulk?op_type=create HTTP/1.1" 400 120

I did some skulking around and found this:

elastic/elasticsearch#1375

That suggests that the _bulk endpoint pyelasticsearch is using is new as of ES 0.18.0.

I kind of need to support 0.17.9 because I'm pretty sure Mozilla hasn't moved all our sites over to a later version, yet.

Anyone mind if I do a patch that changes the endpoint used to just /_bulk? Since we're putting the index and doctype in the action, that would work fine.

@willkg
Copy link
Contributor Author

willkg commented Jan 23, 2013

One nice thing is that running ES 0.17.9 and running the pyelasticsearch tests causes testBulkIndex to fail:

testBulkIndex (pyelasticsearch.tests.IndexingTestCase) ... ERROR
...
======================================================================
ERROR: testBulkIndex (pyelasticsearch.tests.IndexingTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/willkg/mozilla/pyelasticsearch/pyelasticsearch/tests.py", line 187, in testBulkIndex
    result = self.conn.bulk_index('test-index', 'test-type', docs)
  File "/home/willkg/mozilla/pyelasticsearch/pyelasticsearch/client.py", line 79, in decorate
    return func(*args, query_params=query_params, **kwargs)
  File "/home/willkg/mozilla/pyelasticsearch/pyelasticsearch/client.py", line 342, in bulk_index
    query_params=query_params)
  File "/home/willkg/mozilla/pyelasticsearch/pyelasticsearch/client.py", line 227, in send_request
    prepped_response.get('error', prepped_response))
ElasticHttpError: (400, u"InvalidTypeNameException[mapping type name [_bulk] can't start with '_']")

----------------------------------------------------------------------

I'll do up a patch now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants