Hi Luca,
I try to set the '_id' field, but it throws and error when I do. I did some
searches about this but it's still not clear why I can't specify _id.
Traceback (most recent call last):
File "load-pyes.py", line 25, in
conn.index('default','lexeme',entry,id=i)
File "/usr/local/lib/python2.7/dist-packages/pyelasticsearch/client.py",
line 96, in decorate
return func(*args, query_params=query_params, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pyelasticsearch/client.py",
line 344, in index
query_params)
File "/usr/local/lib/python2.7/dist-packages/pyelasticsearch/client.py",
line 254, in send_request
self._raise_exception(resp, prepped_response)
File "/usr/local/lib/python2.7/dist-packages/pyelasticsearch/client.py",
line 269, in _raise_exception
raise error_class(response.status_code, error_message)
pyelasticsearch.exceptions.ElasticHttpError: (400,
u'MapperParsingException[failed to parse [_id]]; nested:
MapperParsingException[Provided id [1] does not match the content one
[f5e638cc78dd325906c1298a0c21fb6b]]; ')
On Wednesday, November 13, 2013 1:05:41 PM UTC-5, Luca Cavanna wrote:
What do you mean by "controlling the _id"? Using the index api, you need
to send index, type and id (optional), plus the document itself as request
body.
If you so send the _id, you can control what value you use for it,
otherwise it's going to be auto-generated. In case it is auto0generated in
order to overwrite an existing document you need to retrieve it and get its
_id back.
Does this help?
On Wednesday, November 13, 2013 4:14:24 PM UTC+1, project2501 wrote:
Hi,
I notice I cannot store a document and control the _id field. It gives
an error. I read that I need to 'enable' storing _id?
That is very odd.
I want to store a bunch of documents. And then I want to update ones by
simply overwriting them with same _id.
I don't want to have to query to get an _id, that is a waste of time.
How can this be done? Upsert? I need to control the _id
thanks.
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.