Modifying data to existing documents


#1

What I want try to do given by example:
This below is first index
PUT /customer/_doc/1?pretty
{
"name": "John Doe"
}
Again, the above will index the specified document into the customer index, with the ID of 1. If we then executed the above command again with a different (or same) document, Elasticsearch will replace (i.e. reindex) a new document on top of the existing one with the ID of 1:

PUT /customer/_doc/1?pretty
{
"name": "Jane Doe"
}

The above changes the name of the document with the ID of 1 from "John Doe" to "Jane Doe". If, on the other hand, we use a different ID, a new document will be indexed and the existing document(s) already in the index remains untouched.

But I dont want as above result will show. I want both values become array like below:

PUT /customer/_doc/1?pretty
{
"name": "Jane Doe",
"name": "Jone Doe"
}

Kindly tell me how I can do this to all documents.

Thank you.


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.