Reputation: 5890
I'm using ElasticSearch Python API, I found if the _id
is same the old data would be overwritten. e.g. I had name="Tom"
, right now I index the same _id
with field age=30
. I found the name="Tom"
was removed after the reindex. The right result I hope age=30
only appended to the existing index. Should I tune any parameters please?
I'm using the following code:
from elasticsearch import Elasticsearch
es = Elasticsearch("http://10.0.0.1:9200")
res = es.index(index="panavstream", doc_type='panav', id="123", body=doc)
Thanks in Advance
Upvotes: 0
Views: 2133
Reputation: 14227
update
function with script
body can append a field in data. elasticsearch-py update
the sample:
doc = {
'script' : 'ctx._source.age = 30'
}
es.update(index="panavstream", doc_type='panav', id="123", body=doc)
Upvotes: 3