# Unexpected token i error?

**URL:** <https://discuss.elastic.co/t/unexpected-token-i-error/24472>\
**Category:** Elasticsearch\
**Created:** [June 27, 2015, 4:59am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472 "2015-06-27T04:59:30Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![linlma](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@linlma](https://discuss.elastic.co/u/linlma)\
**Post date:** [June 27, 2015, 4:59am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472/1 "2015-06-27T04:59:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 27, 2015, 8:14am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472/2 "2015-06-27T08:14:36Z")

</div>

What tool are you using? Curl?

What is the exact command?

---

<div class="post-metadata">

**Author:** ![linlma](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@linlma](https://discuss.elastic.co/u/linlma)\
**Post date:** [June 28, 2015, 6:21am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472/3 "2015-06-28T06:21:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 28, 2015, 7:01am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472/4 "2015-06-28T07:01:19Z")

</div>

To which URL?

---

<div class="post-metadata">

**Author:** ![linlma](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@linlma](https://discuss.elastic.co/u/linlma)\
**Post date:** [June 28, 2015, 8:06am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472/5 "2015-06-28T08:06:49Z")

</div>

Hi dadoonet,

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

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

regards,  
Lin

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 28, 2015, 9:07am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472/6 "2015-06-28T09:07:48Z")

</div>

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:

```auto
{
  "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.

---

<div class="post-metadata">

**Author:** ![linlma](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@linlma](https://discuss.elastic.co/u/linlma)\
**Post date:** [June 29, 2015, 4:29am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472/7 "2015-06-29T04:29:01Z")

</div>

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. 😄

 ![](https://us1.discourse-cdn.com/elastic/original/2X/4/45e2e555729687f24dea7e3b27befe6e0b10c49b.png)

regards,  
Lin

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 29, 2015, 4:49am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472/8 "2015-06-29T04:49:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![linlma](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@linlma](https://discuss.elastic.co/u/linlma)\
**Post date:** [June 29, 2015, 5:49am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472/9 "2015-06-29T05:49:03Z")

</div>

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](http://10.10.10.123:9200/customer/sales/_search)

regards,  
Lin

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 29, 2015, 6:44am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472/10 "2015-06-29T06:44:40Z")

</div>

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

It's JSON content here.

---

<div class="post-metadata">

**Author:** ![linlma](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@linlma](https://discuss.elastic.co/u/linlma)\
**Post date:** [June 29, 2015, 7:37am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472/11 "2015-06-29T07:37:10Z")

</div>

Hi David,

Good catch. Any ideas how to fix it? 😄

regards,  
Lin

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 29, 2015, 7:49am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472/12 "2015-06-29T07:49:09Z")

</div>

Yes. Change the value.

---

<div class="post-metadata">

**Author:** ![linlma](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@linlma](https://discuss.elastic.co/u/linlma)\
**Post date:** [June 29, 2015, 8:03am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472/13 "2015-06-29T08:03:23Z")

</div>

Hi David,

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

regards,  
Lin

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 29, 2015, 9:16am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472/14 "2015-06-29T09:16:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:04am UTC](https://discuss.elastic.co/t/unexpected-token-i-error/24472/15 "2017-07-06T00:04:51Z")

</div>


