Elastic search document indexing


(Prem Shahukhal) #1

Hello
I am new to Elastic search .I have been trying to post a json file containing number of documents using '_bulk' endpoint .The command I use is
curl -XPOST "http://localhost:9200/[index]/[type]/_bulk" --data-binary @json
My json file looks like this

{"index":{}}
{"name": "user1","title": "title1","address": "address1" }

 I have few questions related to this 

1.Do i really need to include '{"index":{}}' above every json data ?Is there a work around to post the json file in bulk in formats other than this without including '{"index":{}}'.
2. I want to make the documents unique based on combination of name and title so that when I post the json data with same name and title but different address it should update the document instead of creating a new one .How can i achieve this
3. LIke post.jar in SOLR, are there any jars for elastic search to index data ?


(Mark Walkom) #2

Take a look at https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html for some more information around using bulk, it should help.


(David Pilato) #3
  1. Yes you have to.
  2. Use an _id composed of name and title and may be encode it with BASE64
  3. Use elasticsearch java client

My cents


(system) #4