ElasticSearch error while sending data
In Windows environment, I solved this problem.
-d plus double quotation(")
and surround name with backslash plus double quotaton(\")
command>
curl (more-option) -d "{\"column1\": \"abc\", \"column2\": \"def\", \"column3\": \"dghi\", \"column4\": \"jkl\", \"column5\": \"mno\"}"
Try using curly brackets first, then naming the array. Try that and see if it works.
For example:
{root:[1, 2, 3, 4, 5]}
might work because it's contained inside an object.
Even better; while I was experimenting with JSON.stringify();
, I found that it coverts arrays to JSON like so:
{1, 2, 3, 4, 5}
thanks @hellol11
it worked when I changed to
{root :
[
{"column1": "abc", "column2": "def", "column3": "dghi", "column4": "jkl", "column5": "mno"},
{"column1": "pqr", "column2": "stu", "column3": "vwx", "column4": "", "column5": ""}
]}
I recently ran into this using curl and it was a simple typo. I was not using inline json, but from a file. I forgot to include the @ sign before the filename.
curl -XPUT -H'Content-Type:application/json' localhost:9200/twitter [email protected]