Elasticsearch Indexing based on data input

I wish to push documents in Json format and wish to update it based on the input data, to be specifiv like unique identifier present in data, ( if that unique identifier value is already present in indexed data, it should update the existing data with the upcoming updated data and if the data is not there then it should be inserted into the index ), i wish to customize the _id metadata field is that possible in elasticsearch or do i have to customize anything for that

I'm not sure I understood all (an concrete example would help) but I don't think you can do that out of the box with elasticsearch.

thankyou is there any way of doing it with logstash filters based on the input data, as in case of beats, it identifies based on input data.

As I said, I'm not sure to understand. A concrete example would help.

this is what i need, i have sample json data such as below which is going to be pushed to elasticsearch.
sample data json:

{
	"phone":"9994825",
	"name":"raju",
	"client_id":"3"
}

updated post data:

{
	"phone":"9994825",
	"name":"raju",
	"address":"madurai",
	"client_id":"3",
	"city":"trichy"
}

uuid or doc id should be based on client_id which is on my input data json, whenever i push this json with addedfields ( updated_post_data) or columns with same client_id, the same document should be updated in elasticsearch. this is what i wish to do, it should not be inserted as new document inside the elasticsearch.

Not sure I have the full picture. But you can do:

DELETE test
PUT test
PUT test/_doc/3
{
	"phone":"9994825",
	"name":"raju",
	"client_id":"3"
}
PUT test/_doc/3
{
	"phone":"9994825",
	"name":"raju",
	"address":"madurai",
	"client_id":"3",
	"city":"trichy"
}
GET test/_doc/3

Thanks @dadoonet, but i cant have control over the data posted url. i have to think any other way is there to perform this.

I still don't understand the problem.

As I did it, could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

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