I have the following document structure
{ "id": "977373", "name": "Air Odisha" }
I want to create documents in bulk only if id and name are not present already.
I have the following document structure
{ "id": "977373", "name": "Air Odisha" }
I want to create documents in bulk only if id and name are not present already.
Welcome to our community!
The closest thing would be an upsert.
You can specify the action in the bulk request to be create
instead of index
. This will create a new document and fail if the document already exists. There is an example in the docs.
That upsert is based on _id of the document but I need to check the matching document based on two keys(id, name) of the document. So it's like I have to create thousands of documents in the ES and the condition is to create the documents only when there is no matching(id & name) in the ES for all the document to be inserted.
The you need to create the document id based on the two fields you mentioned.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.