My requirement is that i want to create index with bulk data in c program without using file, because you know it involves reading from disk also which will make my program slow. So without using file, can i store multiple datas in json format in string and in one shot add the datas to an index or is there any way to do that. I already checked that either we will put the data after -d'{ and by entering one by one we can put the datas, but is there any way like using newline character it will accept the whole dataset in one shot. Please reply me if you find anything regarding this.
Already saw the link and tried with"\n" option in bulk api in c. But its not working. Can you show me one example where how i can use this api to create index and enter multiple data in one shot without using file. It should read data from a string or structure or somethingline this. In all the places i saw they are using json file to enter bulk datas.
But i need how do i store multiple datas in a data structure and and push them to elasticsearch in one shot at some point of time.
Any updates guys....about bulk API in C program without using file.
You do not need a file, just pass the bulk requests in the body of your request:
$ curl -XPOST localhost:9200/_bulk -d '
{ "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
{ "field1" : "value1" }
{ "index" : { "_index" : "test", "_type" : "type1", "_id" : "2" } }
{ "field1" : "value2" }
'