Thanks David for replying.
I tried with the end of line character as well, but it still does not work.
$ curl -XPOST localhost:9200/_bulk -d '{ "delete" : { "_index" : "test",
"_type" : "type1", "_id" : "5"}}\n'
{"error":"ActionRequestValidationException[Validation Failed: 1: no
requests added;]","status":500}
I am actually (trying) to follow the documentation
(Elasticsearch Platform — Find real-time answers at scale | Elastic), and using a
text file as input does work fine (with the --data-binary flag). What I
wish to know is how to make the request with the -d flag, without a text
file, by just passing the input as a string ...
On Tuesday, 4 December 2012 12:12:42 UTC+1, David Pilato wrote:
Hi Sylvain.
Have a look at Elasticsearch Platform — Find real-time answers at scale | Elastic
NOTE: the final line of data must end with a newline character \n.
If you’re providing text file input to curl, you must use the
--data-binary flag instead of plain -d. The latter doesn’t preserve
newlines.
Could it be your concern?
David.
Le 4 décembre 2012 à 12:06, sylvain <sylvain....@ezeep.com <javascript:>>
a écrit :
Hi,
if someone could indicate what is wrong in the following request, that
would be nice.
$ curl -XPOST localhost:9200/_bulk -d '{ "delete" : { "_index" :
"test", "_type" : "type1", "_id" : "5"}}'
The output of the above request is:
{"error":"ActionRequestValidationException[Validation Failed: 1: no
requests added;]","status":500}
When passing the request input into a file it works fine, as shown below
...
$ curl -XPOST localhost:9200/_bulk --data-binary @delete_req; echo
{"took":0,"items":[{"delete":{"_index":"test","_type":"type1","_id":"5","_version":3,"ok":true}}]}
where the file delete_req contains the same input that is used with the
-d flag approach.
$ cat delete_req
{ "delete" : { "_index" : "test", "_type" : "type1", "_id" : "5"}}
So, I guess I am overlooking a detail, and I would be grateful if someone
could point out the proper way to use the -d flag approach.
Thanks,
Sylvain
--
--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
--