"reason" : "Unrecognized token 'John': was expecting ('true', 'false' or 'null')


This is the first time I am trying to use Elastic Search. I am unable to feed data to it.

here is the command (Having issues with this command):

curl -XPUT localhost:9200/customer/external/1?pretty -d {"name":"John"}

But if I give the same command as below,its working:

curl -XPUT localhost:9200/customer/external/1?pretty -d {"name":true}

Any suggestions will be very helpful.


I would like to update that I am using windows.
PS:Its working if I keep the document in a file and use it.

It's because you have indexed a first document with name as a boolean.
Remove your index and it will work.

Can you please explain about how can I do that? I just created an index using XPUT as per the document given in Elastic Search.

Please suggest.


See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html

i had the same problem and found another the solution:

In windows, if a double-quoted argument itself contains a double quote character, the double quote must be doubled.

With this information i've modified the command and it works now:
curl -XPUT 'localhost:9200/customer/external/1?pretty' -d '{""name"": ""John Doe""}'

1 Like