Unexpected token i error?

Hello ElasticSearch experts,

I am a new user of ElasticSearch, I am testing with basic query below and got error of "Unexpected token i",

Does anyone have any thoughts?

{
  "query": {
    "match_all" : { }
  }
}

thanks in advance,
Lin

What tool are you using? Curl?

What is the exact command?

Hi dadoonet,

I am using Advanced REST client in Chrome as a plug-in to send POST request. Is there any recommended curl command to try? If so, appreciate if you could share the command to me and I will have a try.

Is there anything wrong with the command itself?

regards,
Lin

To which URL?

Hi dadoonet,

I setup a local instance which is not accessible from outside. :frowning:

For URL, anything I need to check for the issue I met with?

regards,
Lin

I don't understand what you are doing.

What I know from now:

  • you send a POST request from Chrome REST Client to an unknown URL
  • You try to add the following payload:
{
  "query": {
    "match_all" : { }
  }
}

I have no clue based on this too few informations what is the source of your error.
I never saw such an error: Unexpected token i

May be you can try to make a screenshot so we can understand what you are doing.

Hi dadoonet,

For sure, here is the screen snapshots. Any ideas how to test further to resolve this issue is appreciated. Have a good night. :smile:

regards,
Lin

Change the content type
Also I still can't see what is the URL.

Hi David,

Dumb question, what do you mean content type?

And if you mean the URL address, it is an internal address which cannot be accessed from out side,

http://10.10.10.123:9200/customer/sales/_search

regards,
Lin

You are sending your POST request using something like a FORM: application/x-www-form-urlencoded.
It's not.

It's JSON content here.

Hi David,

Good catch. Any ideas how to fix it? :smile:

regards,
Lin

Yes. Change the value.

Hi David,

You mean change "application/x-www-form-urlencoded" to what value?

regards,
Lin

http://www.ietf.org/rfc/rfc4627.txt says application/json. I'm pretty sure you have that in your dropdown list.