If you’re utilizing the Official ElasticSearch Python library (Docs), and also you need to create an index:
doc = {
"one thing": "123a",
"somethingelse": "456b",
"timestamp": datetime.now(),
"historical past": []
}
es.index(index="someindex", doc_type="somedoctype", id="someid", physique=doc)
You’ll be able to append gadgets to the historical past every time, as a substitute of overriding them, like this:
es.replace(index="someindex", doc_type="somedoctype", id="someid",
physique={
"script" : {
"supply": "ctx._source.historical past.addAll(params.historical past)",
"lang": "painless",
"params" : {
"historical past" : ["item1","item2"]
}
}
})
This makes use of scripted updates in Elasticsearch, for appending to an array.