# IllegalStateException\[field \\"DISPLAY\_NAME\\" was indexed without position data

**URL:** <https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194>\
**Category:** Elasticsearch\
**Created:** [April 25, 2014, 10:24am UTC](https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194 "2014-04-25T10:24:43Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![cyrilforce](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cyrilforce](https://discuss.elastic.co/u/cyrilforce)\
**Post date:** [April 25, 2014, 10:24am UTC](https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194/1 "2014-04-25T10:24:43Z")

</div>

Hi,

I am trying to query some records via the span\_first query as below :

{  
"from" : 100,  
"size" : 100,  
"query" : {  
"span\_first" : {  
"match" : {  
\* "span\_term" : { "DISPLAY\_NAME" : "happy" }\*  
},  
"end" : 1  
}  
}  
}

however it returned me with an error :

```
        "index": "jdbc_dev",
            "shard": 4,
            "status": 500,
        * "reason": 

```

"RemoteTransportException[[portal-web-02][inet[/192.168.96.27:9300]][search/phase/query/id]];  
nested: QueryPhaseExecutionException[[jdbc\_dev][4]:  
query[filtered(spanFirst(DISPLAY\_NAME:happy,  
1))-\>cache(\_type:media)],from[100],size[100]: Query Failed [Failed to  
execute main query]]; nested: IllegalStateException[field "DISPLAY\_NAME"  
was indexed without position data; cannot run SpanTermQuery (term=happy)];  
"\*  
}

The mapping for that type :

{  
"media": {  
"properties": {  
"AUDIO": {  
"type": "string"  
},  
"BILLINGTYPE\_ID": {  
"type": "long"  
},  
"CATMEDIA\_CDATE": {  
"type": "date",  
"format": "dateOptionalTime"  
},  
"CATMEDIA\_NAME": {  
"type": "string"  
},  
"CATMEDIA\_RANK": {  
"type": "long"  
},  
"CAT\_ID": {  
"type": "long"  
},  
"CAT\_NAME": {  
"type": "string",  
"analyzer": "string\_lowercase",  
"include\_in\_all": true  
},  
"CAT\_PARENT": {  
"type": "long"  
},  
"CHANNEL\_ID": {  
"type": "long"  
},  
"CKEY": {  
"type": "long"  
},  
\* "DISPLAY\_NAME": {\*

- 

```
           "type": "string",*

```

- 

```
           "analyzer": "standard"*

```

- 

```
       },*
      "FTID": {
          "type": "string"
      },
      "GENRE": {
          "type": "string"
      },
      "ITEMCODE": {
          "type": "string"
      },
      "KEYWORDS": {
          "type": "string"
      },
      "LANG_ID": {
          "type": "long"
      },
      "LONG_DESCRIPTION": {
          "type": "string"
      },
      "MAPPINGS": {
          "type": "string",
          "analyzer": "string_lowercase",
          "include_in_all": true
      },
      "MEDIA_ID": {
          "type": "long"
      },
      "MEDIA_PKEY": {
          "type": "string"
      },
      "PERFORMER": {
          "type": "string"
      },
      "PLAYER": {
          "type": "string"
      },
      "POSITION": {
          "type": "long"
      },
      "PRICE": {
          "type": "double"
      },
      "PRIORITY": {
          "type": "long"
      },
      "SHORTCODE": {
          "type": "string"
      },
      "SHORT_DESCRIPTION": {
          "type": "string"
      },
      "TYPE_ID": {
          "type": "long"
      },
      "VIEW_ID": {
          "type": "long"
      }
  }

```

}  
}

I would like to know what is the reason and how i could fix it. Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [April 26, 2014, 12:31am UTC](https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194/2 "2014-04-26T00:31:56Z")

</div>

Your mapping looks correct. Which version are you running? Do you have any  
templates?

Just to be on the safe side, can you provide the mapping that Elasticsearch  
is using (not the one you provide):

[http://localhost:9200/jdbc\_dev/media/\_mapping](http://localhost:9200/jdbc_dev/media/_mapping)

--  
Ivan

On Fri, Apr 25, 2014 at 3:24 AM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com) wrote:

> Hi,
> 
> I am trying to query some records via the span\_first query as below :
> 
> {  
> "from" : 100,  
> "size" : 100,  
> "query" : {  
> "span\_first" : {  
> "match" : {  
> \* "span\_term" : { "DISPLAY\_NAME" : "happy" }\*  
> },  
> "end" : 1  
> }  
> }  
> }
> 
> however it returned me with an error :
> 
> ```
> "index": "jdbc_dev",
> "shard": 4,
> "status": 500,
> * "reason":
> 
> ```
> 
> "RemoteTransportException[[portal-web-02][inet[/192.168.96.27:9300]][search/phase/query/id]];  
> nested: QueryPhaseExecutionException[[jdbc\_dev][4]:  
> query[filtered(spanFirst(DISPLAY\_NAME:happy,  
> 1))-\>cache(\_type:media)],from[100],size[100]: Query Failed [Failed to  
> execute main query]]; nested: IllegalStateException[field "DISPLAY\_NAME"  
> was indexed without position data; cannot run SpanTermQuery (term=happy)];  
> "\*  
> }
> 
> The mapping for that type :
> 
> {  
> "media": {  
> "properties": {  
> "AUDIO": {  
> "type": "string"  
> },  
> "BILLINGTYPE\_ID": {  
> "type": "long"  
> },  
> "CATMEDIA\_CDATE": {  
> "type": "date",  
> "format": "dateOptionalTime"  
> },  
> "CATMEDIA\_NAME": {  
> "type": "string"  
> },  
> "CATMEDIA\_RANK": {  
> "type": "long"  
> },  
> "CAT\_ID": {  
> "type": "long"  
> },  
> "CAT\_NAME": {  
> "type": "string",  
> "analyzer": "string\_lowercase",  
> "include\_in\_all": true  
> },  
> "CAT\_PARENT": {  
> "type": "long"  
> },  
> "CHANNEL\_ID": {  
> "type": "long"  
> },  
> "CKEY": {  
> "type": "long"  
> },  
> \* "DISPLAY\_NAME": {\*
> 
> - 
> 
> ```
> "type": "string",*
> 
> ```
> 
> - 
> 
> ```
> "analyzer": "standard"*
> 
> ```
> 
> - 
> 
> ```
> },*
> "FTID": {
> "type": "string"
> },
> "GENRE": {
> "type": "string"
> },
> "ITEMCODE": {
> "type": "string"
> },
> "KEYWORDS": {
> "type": "string"
> },
> "LANG_ID": {
> "type": "long"
> },
> "LONG_DESCRIPTION": {
> "type": "string"
> },
> "MAPPINGS": {
> "type": "string",
> "analyzer": "string_lowercase",
> "include_in_all": true
> },
> "MEDIA_ID": {
> "type": "long"
> },
> "MEDIA_PKEY": {
> "type": "string"
> },
> "PERFORMER": {
> "type": "string"
> },
> "PLAYER": {
> "type": "string"
> },
> "POSITION": {
> "type": "long"
> },
> "PRICE": {
> "type": "double"
> },
> "PRIORITY": {
> "type": "long"
> },
> "SHORTCODE": {
> "type": "string"
> },
> "SHORT_DESCRIPTION": {
> "type": "string"
> },
> "TYPE_ID": {
> "type": "long"
> },
> "VIEW_ID": {
> "type": "long"
> }
> }
> 
> ```
> 
> }  
> }
> 
> I would like to know what is the reason and how i could fix it. Thanks.
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![cyrilforce](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cyrilforce](https://discuss.elastic.co/u/cyrilforce)\
**Post date:** [April 26, 2014, 6:55pm UTC](https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194/3 "2014-04-26T18:55:37Z")

</div>

Hi Ivan,

I am using version elasticsearch-0.90.1. Nope we don't have any templates.  
Not sure whether your are referring to the full index mapping here's the  
gist

media mapping

> <https://gist.github.com/cheehoo/11327970>

full index mapping

> <https://gist.github.com/cheehoo/11327996>

Thanks in advance.

On Sat, Apr 26, 2014 at 8:31 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Your mapping looks correct. Which version are you running? Do you have any  
> templates?
> 
> Just to be on the safe side, can you provide the mapping that  
> Elasticsearch is using (not the one you provide):
> 
> [http://localhost:9200/jdbc\_dev/media/\_mapping](http://localhost:9200/jdbc_dev/media/_mapping)
> 
> --  
> Ivan
> 
> On Fri, Apr 25, 2014 at 3:24 AM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com) wrote:
> 
> > Hi,
> > 
> > I am trying to query some records via the span\_first query as below :
> > 
> > {  
> > "from" : 100,  
> > "size" : 100,  
> > "query" : {  
> > "span\_first" : {  
> > "match" : {  
> > \* "span\_term" : { "DISPLAY\_NAME" : "happy" }\*  
> > },  
> > "end" : 1  
> > }  
> > }  
> > }
> > 
> > however it returned me with an error :
> > 
> > ```
> > "index": "jdbc_dev",
> > "shard": 4,
> > "status": 500,
> > * "reason":
> > 
> > ```
> > 
> > "RemoteTransportException[[portal-web-02][inet[/192.168.96.27:9300]][search/phase/query/id]];  
> > nested: QueryPhaseExecutionException[[jdbc\_dev][4]:  
> > query[filtered(spanFirst(DISPLAY\_NAME:happy,  
> > 1))-\>cache(\_type:media)],from[100],size[100]: Query Failed [Failed to  
> > execute main query]]; nested: IllegalStateException[field "DISPLAY\_NAME"  
> > was indexed without position data; cannot run SpanTermQuery (term=happy)];  
> > "\*  
> > }
> > 
> > The mapping for that type :
> > 
> > {  
> > "media": {  
> > "properties": {  
> > "AUDIO": {  
> > "type": "string"  
> > },  
> > "BILLINGTYPE\_ID": {  
> > "type": "long"  
> > },  
> > "CATMEDIA\_CDATE": {  
> > "type": "date",  
> > "format": "dateOptionalTime"  
> > },  
> > "CATMEDIA\_NAME": {  
> > "type": "string"  
> > },  
> > "CATMEDIA\_RANK": {  
> > "type": "long"  
> > },  
> > "CAT\_ID": {  
> > "type": "long"  
> > },  
> > "CAT\_NAME": {  
> > "type": "string",  
> > "analyzer": "string\_lowercase",  
> > "include\_in\_all": true  
> > },  
> > "CAT\_PARENT": {  
> > "type": "long"  
> > },  
> > "CHANNEL\_ID": {  
> > "type": "long"  
> > },  
> > "CKEY": {  
> > "type": "long"  
> > },  
> > \* "DISPLAY\_NAME": {\*
> > 
> > - 
> > 
> > ```
> > "type": "string",*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "analyzer": "standard"*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > },*
> > "FTID": {
> > "type": "string"
> > },
> > "GENRE": {
> > "type": "string"
> > },
> > "ITEMCODE": {
> > "type": "string"
> > },
> > "KEYWORDS": {
> > "type": "string"
> > },
> > "LANG_ID": {
> > "type": "long"
> > },
> > "LONG_DESCRIPTION": {
> > "type": "string"
> > },
> > "MAPPINGS": {
> > "type": "string",
> > "analyzer": "string_lowercase",
> > "include_in_all": true
> > },
> > "MEDIA_ID": {
> > "type": "long"
> > },
> > "MEDIA_PKEY": {
> > "type": "string"
> > },
> > "PERFORMER": {
> > "type": "string"
> > },
> > "PLAYER": {
> > "type": "string"
> > },
> > "POSITION": {
> > "type": "long"
> > },
> > "PRICE": {
> > "type": "double"
> > },
> > "PRIORITY": {
> > "type": "long"
> > },
> > "SHORTCODE": {
> > "type": "string"
> > },
> > "SHORT_DESCRIPTION": {
> > "type": "string"
> > },
> > "TYPE_ID": {
> > "type": "long"
> > },
> > "VIEW_ID": {
> > "type": "long"
> > }
> > }
> > 
> > ```
> > 
> > }  
> > }
> > 
> > I would like to know what is the reason and how i could fix it. Thanks.
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > 
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Regards,

Chee Hoo

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg\_9Nq6sL%2BYfhXSY60DpV8\_JqV55ypWgGczzQcUGEsKE8Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg_9Nq6sL%2BYfhXSY60DpV8_JqV55ypWgGczzQcUGEsKE8Q%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![cyrilforce](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cyrilforce](https://discuss.elastic.co/u/cyrilforce)\
**Post date:** [April 28, 2014, 6:24am UTC](https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194/4 "2014-04-28T06:24:43Z")

</div>

Hi Ivan,

I recreate the mapping and re-index the documents and now working fine.  
Thanks.

Btw would like to ask how i could search two or more words in the  
span\_first query as i need it to support the following searches :  
1)happy  
2)happy holiday  
3)happy birthday to you

{  
"from" : 100,  
"size" : 100,  
"query" : {  
"span\_first" : {  
"match" : {  
\* "span\_term" : { "DISPLAY\_NAME" : "happy holiday" }\*  
},  
"end" : 1  
}  
}  
}

returns empty list even we have documents that display\_name start with _happy  
holiday_.

Thanks.

On Sunday, April 27, 2014 2:55:37 AM UTC+8, cyrilforce wrote:

> Hi Ivan,
> 
> I am using version elasticsearch-0.90.1. Nope we don't have any templates.  
> Not sure whether your are referring to the full index mapping here's the  
> gist
> 
> media mapping  
> [span\_first\_issue\_media\_mapping.json · GitHub](https://gist.github.com/cheehoo/11327970)
> 
> full index mapping  
> [span\_first\_issue\_full\_index\_mappping.json · GitHub](https://gist.github.com/cheehoo/11327996)
> 
> Thanks in advance.
> 
> On Sat, Apr 26, 2014 at 8:31 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> 
> > Your mapping looks correct. Which version are you running? Do you have  
> > any templates?
> > 
> > Just to be on the safe side, can you provide the mapping that  
> > Elasticsearch is using (not the one you provide):
> > 
> > [http://localhost:9200/jdbc\_dev/media/\_mapping](http://localhost:9200/jdbc_dev/media/_mapping)
> > 
> > --  
> > Ivan
> > 
> > On Fri, Apr 25, 2014 at 3:24 AM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com) wrote:
> > 
> > > Hi,
> > > 
> > > I am trying to query some records via the span\_first query as below :
> > > 
> > > {  
> > > "from" : 100,  
> > > "size" : 100,  
> > > "query" : {  
> > > "span\_first" : {  
> > > "match" : {  
> > > \* "span\_term" : { "DISPLAY\_NAME" : "happy" }\*  
> > > },  
> > > "end" : 1  
> > > }  
> > > }  
> > > }
> > > 
> > > however it returned me with an error :
> > > 
> > > ```
> > > "index": "jdbc_dev",
> > > "shard": 4,
> > > "status": 500,
> > > * "reason": 
> > > 
> > > ```
> > > 
> > > "RemoteTransportException[[portal-web-02][inet[/192.168.96.27:9300]][search/phase/query/id]];  
> > > nested: QueryPhaseExecutionException[[jdbc\_dev][4]:  
> > > query[filtered(spanFirst(DISPLAY\_NAME:happy,  
> > > 1))-\>cache(\_type:media)],from[100],size[100]: Query Failed [Failed to  
> > > execute main query]]; nested: IllegalStateException[field "DISPLAY\_NAME"  
> > > was indexed without position data; cannot run SpanTermQuery (term=happy)];  
> > > "\*  
> > > }
> > > 
> > > The mapping for that type :
> > > 
> > > {  
> > > "media": {  
> > > "properties": {  
> > > "AUDIO": {  
> > > "type": "string"  
> > > },  
> > > "BILLINGTYPE\_ID": {  
> > > "type": "long"  
> > > },  
> > > "CATMEDIA\_CDATE": {  
> > > "type": "date",  
> > > "format": "dateOptionalTime"  
> > > },  
> > > "CATMEDIA\_NAME": {  
> > > "type": "string"  
> > > },  
> > > "CATMEDIA\_RANK": {  
> > > "type": "long"  
> > > },  
> > > "CAT\_ID": {  
> > > "type": "long"  
> > > },  
> > > "CAT\_NAME": {  
> > > "type": "string",  
> > > "analyzer": "string\_lowercase",  
> > > "include\_in\_all": true  
> > > },  
> > > "CAT\_PARENT": {  
> > > "type": "long"  
> > > },  
> > > "CHANNEL\_ID": {  
> > > "type": "long"  
> > > },  
> > > "CKEY": {  
> > > "type": "long"  
> > > },  
> > > \* "DISPLAY\_NAME": {\*
> > > 
> > > - 
> > > 
> > > ```
> > > "type": "string",*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > "analyzer": "standard"*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > },*
> > > "FTID": {
> > > "type": "string"
> > > },
> > > "GENRE": {
> > > "type": "string"
> > > },
> > > "ITEMCODE": {
> > > "type": "string"
> > > },
> > > "KEYWORDS": {
> > > "type": "string"
> > > },
> > > "LANG_ID": {
> > > "type": "long"
> > > },
> > > "LONG_DESCRIPTION": {
> > > "type": "string"
> > > },
> > > "MAPPINGS": {
> > > "type": "string",
> > > "analyzer": "string_lowercase",
> > > "include_in_all": true
> > > },
> > > "MEDIA_ID": {
> > > "type": "long"
> > > },
> > > "MEDIA_PKEY": {
> > > "type": "string"
> > > },
> > > "PERFORMER": {
> > > "type": "string"
> > > },
> > > "PLAYER": {
> > > "type": "string"
> > > },
> > > "POSITION": {
> > > "type": "long"
> > > },
> > > "PRICE": {
> > > "type": "double"
> > > },
> > > "PRIORITY": {
> > > "type": "long"
> > > },
> > > "SHORTCODE": {
> > > "type": "string"
> > > },
> > > "SHORT_DESCRIPTION": {
> > > "type": "string"
> > > },
> > > "TYPE_ID": {
> > > "type": "long"
> > > },
> > > "VIEW_ID": {
> > > "type": "long"
> > > }
> > > }
> > > 
> > > ```
> > > 
> > > }  
> > > }
> > > 
> > > I would like to know what is the reason and how i could fix it. Thanks.
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > > 
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Regards,
> 
> Chee Hoo

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [April 28, 2014, 4:16pm UTC](https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194/5 "2014-04-28T16:16:44Z")

</div>

The main limitation of the span queries is that they only operate on  
analyzed terms. The terms used in span\_term must match the terms in the  
index. In your case, there is no single term "happy holiday" in your index,  
because the original document was tokenized into "happy" "birthday" "to"  
"you".

You would need to do a span near query of the two terms with a slop of 1  
and in order. This span near query will then be the argument to the span  
first.

Here is a good explanation of span queries in Lucene:  
[http://searchhub.org/2009/07/18/the-spanquery/](http://searchhub.org/2009/07/18/the-spanquery/)

--  
Ivan

On Sun, Apr 27, 2014 at 11:24 PM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com) wrote:

> Hi Ivan,
> 
> I recreate the mapping and re-index the documents and now working fine.  
> Thanks.
> 
> Btw would like to ask how i could search two or more words in the  
> span\_first query as i need it to support the following searches :  
> 1)happy  
> 2)happy holiday  
> 3)happy birthday to you
> 
> {  
> "from" : 100,  
> "size" : 100,  
> "query" : {  
> "span\_first" : {  
> "match" : {  
> \* "span\_term" : { "DISPLAY\_NAME" : "happy holiday" }\*  
> },  
> "end" : 1  
> }  
> }  
> }
> 
> returns empty list even we have documents that display\_name start with _happy  
> holiday_.
> 
> Thanks.
> 
> On Sunday, April 27, 2014 2:55:37 AM UTC+8, cyrilforce wrote:
> 
> > Hi Ivan,
> > 
> > I am using version elasticsearch-0.90.1. Nope we don't have any  
> > templates. Not sure whether your are referring to the full index mapping  
> > here's the gist
> > 
> > media mapping  
> > [span\_first\_issue\_media\_mapping.json · GitHub](https://gist.github.com/cheehoo/11327970)
> > 
> > full index mapping  
> > [span\_first\_issue\_full\_index\_mappping.json · GitHub](https://gist.github.com/cheehoo/11327996)
> > 
> > Thanks in advance.
> > 
> > On Sat, Apr 26, 2014 at 8:31 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > 
> > > Your mapping looks correct. Which version are you running? Do you have  
> > > any templates?
> > > 
> > > Just to be on the safe side, can you provide the mapping that  
> > > Elasticsearch is using (not the one you provide):
> > > 
> > > [http://localhost:9200/jdbc\_dev/media/\_mapping](http://localhost:9200/jdbc_dev/media/_mapping)
> > > 
> > > --  
> > > Ivan
> > > 
> > > On Fri, Apr 25, 2014 at 3:24 AM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com) wrote:
> > > 
> > > > Hi,
> > > > 
> > > > I am trying to query some records via the span\_first query as below :
> > > > 
> > > > {  
> > > > "from" : 100,  
> > > > "size" : 100,  
> > > > "query" : {  
> > > > "span\_first" : {  
> > > > "match" : {  
> > > > \* "span\_term" : { "DISPLAY\_NAME" : "happy" }\*  
> > > > },  
> > > > "end" : 1  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > however it returned me with an error :
> > > > 
> > > > ```
> > > > "index": "jdbc_dev",
> > > > "shard": 4,
> > > > "status": 500,
> > > > * "reason":
> > > > 
> > > > ```
> > > > 
> > > > "RemoteTransportException[[portal-web-02][inet[/192.168.96.27:9300]][search/phase/query/id]];  
> > > > nested: QueryPhaseExecutionException[[jdbc\_dev][4]:  
> > > > query[filtered(spanFirst(DISPLAY\_NAME:happy,  
> > > > 1))-\>cache(\_type:media)],from[100],size[100]: Query Failed [Failed to  
> > > > execute main query]]; nested: IllegalStateException[field "DISPLAY\_NAME"  
> > > > was indexed without position data; cannot run SpanTermQuery (term=happy)];  
> > > > "\*  
> > > > }
> > > > 
> > > > The mapping for that type :
> > > > 
> > > > {  
> > > > "media": {  
> > > > "properties": {  
> > > > "AUDIO": {  
> > > > "type": "string"  
> > > > },  
> > > > "BILLINGTYPE\_ID": {  
> > > > "type": "long"  
> > > > },  
> > > > "CATMEDIA\_CDATE": {  
> > > > "type": "date",  
> > > > "format": "dateOptionalTime"  
> > > > },  
> > > > "CATMEDIA\_NAME": {  
> > > > "type": "string"  
> > > > },  
> > > > "CATMEDIA\_RANK": {  
> > > > "type": "long"  
> > > > },  
> > > > "CAT\_ID": {  
> > > > "type": "long"  
> > > > },  
> > > > "CAT\_NAME": {  
> > > > "type": "string",  
> > > > "analyzer": "string\_lowercase",  
> > > > "include\_in\_all": true  
> > > > },  
> > > > "CAT\_PARENT": {  
> > > > "type": "long"  
> > > > },  
> > > > "CHANNEL\_ID": {  
> > > > "type": "long"  
> > > > },  
> > > > "CKEY": {  
> > > > "type": "long"  
> > > > },  
> > > > \* "DISPLAY\_NAME": {\*
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "type": "string",*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "analyzer": "standard"*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > },*
> > > > "FTID": {
> > > > "type": "string"
> > > > },
> > > > "GENRE": {
> > > > "type": "string"
> > > > },
> > > > "ITEMCODE": {
> > > > "type": "string"
> > > > },
> > > > "KEYWORDS": {
> > > > "type": "string"
> > > > },
> > > > "LANG_ID": {
> > > > "type": "long"
> > > > },
> > > > "LONG_DESCRIPTION": {
> > > > "type": "string"
> > > > },
> > > > "MAPPINGS": {
> > > > "type": "string",
> > > > "analyzer": "string_lowercase",
> > > > "include_in_all": true
> > > > },
> > > > "MEDIA_ID": {
> > > > "type": "long"
> > > > },
> > > > "MEDIA_PKEY": {
> > > > "type": "string"
> > > > },
> > > > "PERFORMER": {
> > > > "type": "string"
> > > > },
> > > > "PLAYER": {
> > > > "type": "string"
> > > > },
> > > > "POSITION": {
> > > > "type": "long"
> > > > },
> > > > "PRICE": {
> > > > "type": "double"
> > > > },
> > > > "PRIORITY": {
> > > > "type": "long"
> > > > },
> > > > "SHORTCODE": {
> > > > "type": "string"
> > > > },
> > > > "SHORT_DESCRIPTION": {
> > > > "type": "string"
> > > > },
> > > > "TYPE_ID": {
> > > > "type": "long"
> > > > },
> > > > "VIEW_ID": {
> > > > "type": "long"
> > > > }
> > > > }
> > > > 
> > > > ```
> > > > 
> > > > }  
> > > > }
> > > > 
> > > > I would like to know what is the reason and how i could fix it. Thanks.
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > > > 
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%  
> > > > [40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > topic/elasticsearch/cwzQrR1Rpsw/unsubscribe.  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%  
> > > 3DvHY0y4qkHdcHrR57nGEc0f1haAw%[40mail.gmail.com](http://40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > Regards,
> > 
> > Chee Hoo
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![cyrilforce](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cyrilforce](https://discuss.elastic.co/u/cyrilforce)\
**Post date:** [April 29, 2014, 2:05am UTC](https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194/6 "2014-04-29T02:05:22Z")

</div>

Hi Ivan,

Not able to get any result with the following query :

{  
"from" : 100,  
"size" : 100,  
"query" : {  
"span\_first" : {  
"match" : {  
"span\_near" : {  
"clauses" : [  
{ "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
{ "span\_term" : { "DISPLAY\_NAME" : "people" } }

```
    ],
    "slop" : 1,
    "in_order" : true
}
    },
    "end" : 1
}

```

}  
}

Meanwhile tried with :

{  
"from" : 100,  
"size" : 100,  
"query" : {  
"span\_first" : {  
"match" : {  
"span\_term" : { "DISPLAY\_NAME" : "happy" }  
},  
"end" : 1  
}  
}  
}

and it returns :

```
  "_index": "jdbc_dev",
            "_type": "media",
            "_id": "9556",
            "_score": 4.612431,
            "_source": {
                "DISPLAY_NAME": "Happy People",

```

Anything wrong with my first query ?

Thanks

On Tue, Apr 29, 2014 at 12:16 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> The main limitation of the span queries is that they only operate on  
> analyzed terms. The terms used in span\_term must match the terms in the  
> index. In your case, there is no single term "happy holiday" in your index,  
> because the original document was tokenized into "happy" "birthday" "to"  
> "you".
> 
> You would need to do a span near query of the two terms with a slop of 1  
> and in order. This span near query will then be the argument to the span  
> first.
> 
> Here is a good explanation of span queries in Lucene:  
> [http://searchhub.org/2009/07/18/the-spanquery/](http://searchhub.org/2009/07/18/the-spanquery/)
> 
> --  
> Ivan
> 
> On Sun, Apr 27, 2014 at 11:24 PM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com) wrote:
> 
> > Hi Ivan,
> > 
> > I recreate the mapping and re-index the documents and now working fine.  
> > Thanks.
> > 
> > Btw would like to ask how i could search two or more words in the  
> > span\_first query as i need it to support the following searches :  
> > 1)happy  
> > 2)happy holiday  
> > 3)happy birthday to you
> > 
> > {  
> > "from" : 100,  
> > "size" : 100,  
> > "query" : {  
> > "span\_first" : {  
> > "match" : {  
> > \* "span\_term" : { "DISPLAY\_NAME" : "happy holiday" }\*  
> > },  
> > "end" : 1  
> > }  
> > }  
> > }
> > 
> > returns empty list even we have documents that display\_name start with _happy  
> > holiday_.
> > 
> > Thanks.
> > 
> > On Sunday, April 27, 2014 2:55:37 AM UTC+8, cyrilforce wrote:
> > 
> > > Hi Ivan,
> > > 
> > > I am using version elasticsearch-0.90.1. Nope we don't have any  
> > > templates. Not sure whether your are referring to the full index mapping  
> > > here's the gist
> > > 
> > > media mapping  
> > > [span\_first\_issue\_media\_mapping.json · GitHub](https://gist.github.com/cheehoo/11327970)
> > > 
> > > full index mapping  
> > > [span\_first\_issue\_full\_index\_mappping.json · GitHub](https://gist.github.com/cheehoo/11327996)
> > > 
> > > Thanks in advance.
> > > 
> > > On Sat, Apr 26, 2014 at 8:31 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > > 
> > > > Your mapping looks correct. Which version are you running? Do you have  
> > > > any templates?
> > > > 
> > > > Just to be on the safe side, can you provide the mapping that  
> > > > Elasticsearch is using (not the one you provide):
> > > > 
> > > > [http://localhost:9200/jdbc\_dev/media/\_mapping](http://localhost:9200/jdbc_dev/media/_mapping)
> > > > 
> > > > --  
> > > > Ivan
> > > > 
> > > > On Fri, Apr 25, 2014 at 3:24 AM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > I am trying to query some records via the span\_first query as below :
> > > > > 
> > > > > {  
> > > > > "from" : 100,  
> > > > > "size" : 100,  
> > > > > "query" : {  
> > > > > "span\_first" : {  
> > > > > "match" : {  
> > > > > \* "span\_term" : { "DISPLAY\_NAME" : "happy" }\*  
> > > > > },  
> > > > > "end" : 1  
> > > > > }  
> > > > > }  
> > > > > }
> > > > > 
> > > > > however it returned me with an error :
> > > > > 
> > > > > ```
> > > > > "index": "jdbc_dev",
> > > > > "shard": 4,
> > > > > "status": 500,
> > > > > * "reason":
> > > > > 
> > > > > ```
> > > > > 
> > > > > "RemoteTransportException[[portal-web-02][inet[/192.168.96.27:9300]][search/phase/query/id]];  
> > > > > nested: QueryPhaseExecutionException[[jdbc\_dev][4]:  
> > > > > query[filtered(spanFirst(DISPLAY\_NAME:happy,  
> > > > > 1))-\>cache(\_type:media)],from[100],size[100]: Query Failed [Failed to  
> > > > > execute main query]]; nested: IllegalStateException[field "DISPLAY\_NAME"  
> > > > > was indexed without position data; cannot run SpanTermQuery (term=happy)];  
> > > > > "\*  
> > > > > }
> > > > > 
> > > > > The mapping for that type :
> > > > > 
> > > > > {  
> > > > > "media": {  
> > > > > "properties": {  
> > > > > "AUDIO": {  
> > > > > "type": "string"  
> > > > > },  
> > > > > "BILLINGTYPE\_ID": {  
> > > > > "type": "long"  
> > > > > },  
> > > > > "CATMEDIA\_CDATE": {  
> > > > > "type": "date",  
> > > > > "format": "dateOptionalTime"  
> > > > > },  
> > > > > "CATMEDIA\_NAME": {  
> > > > > "type": "string"  
> > > > > },  
> > > > > "CATMEDIA\_RANK": {  
> > > > > "type": "long"  
> > > > > },  
> > > > > "CAT\_ID": {  
> > > > > "type": "long"  
> > > > > },  
> > > > > "CAT\_NAME": {  
> > > > > "type": "string",  
> > > > > "analyzer": "string\_lowercase",  
> > > > > "include\_in\_all": true  
> > > > > },  
> > > > > "CAT\_PARENT": {  
> > > > > "type": "long"  
> > > > > },  
> > > > > "CHANNEL\_ID": {  
> > > > > "type": "long"  
> > > > > },  
> > > > > "CKEY": {  
> > > > > "type": "long"  
> > > > > },  
> > > > > \* "DISPLAY\_NAME": {\*
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > "type": "string",*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > "analyzer": "standard"*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > },*
> > > > > "FTID": {
> > > > > "type": "string"
> > > > > },
> > > > > "GENRE": {
> > > > > "type": "string"
> > > > > },
> > > > > "ITEMCODE": {
> > > > > "type": "string"
> > > > > },
> > > > > "KEYWORDS": {
> > > > > "type": "string"
> > > > > },
> > > > > "LANG_ID": {
> > > > > "type": "long"
> > > > > },
> > > > > "LONG_DESCRIPTION": {
> > > > > "type": "string"
> > > > > },
> > > > > "MAPPINGS": {
> > > > > "type": "string",
> > > > > "analyzer": "string_lowercase",
> > > > > "include_in_all": true
> > > > > },
> > > > > "MEDIA_ID": {
> > > > > "type": "long"
> > > > > },
> > > > > "MEDIA_PKEY": {
> > > > > "type": "string"
> > > > > },
> > > > > "PERFORMER": {
> > > > > "type": "string"
> > > > > },
> > > > > "PLAYER": {
> > > > > "type": "string"
> > > > > },
> > > > > "POSITION": {
> > > > > "type": "long"
> > > > > },
> > > > > "PRICE": {
> > > > > "type": "double"
> > > > > },
> > > > > "PRIORITY": {
> > > > > "type": "long"
> > > > > },
> > > > > "SHORTCODE": {
> > > > > "type": "string"
> > > > > },
> > > > > "SHORT_DESCRIPTION": {
> > > > > "type": "string"
> > > > > },
> > > > > "TYPE_ID": {
> > > > > "type": "long"
> > > > > },
> > > > > "VIEW_ID": {
> > > > > "type": "long"
> > > > > }
> > > > > }
> > > > > 
> > > > > ```
> > > > > 
> > > > > }  
> > > > > }
> > > > > 
> > > > > I would like to know what is the reason and how i could fix it.  
> > > > > Thanks.
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to the Google  
> > > > > Groups "elasticsearch" group.  
> > > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > > > > 
> > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%  
> > > > > [40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > .  
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > topic/elasticsearch/cwzQrR1Rpsw/unsubscribe.  
> > > > To unsubscribe from this group and all its topics, send an email to  
> > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%  
> > > > 3DvHY0y4qkHdcHrR57nGEc0f1haAw%[40mail.gmail.com](http://40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > Regards,
> > > 
> > > Chee Hoo
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Regards,

Chee Hoo

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY\_eHFO\_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY_eHFO_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [April 29, 2014, 4:37pm UTC](https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194/7 "2014-04-29T16:37:20Z")

</div>

The end parameter is too low. It needs to be at a minimum the number of  
clauses in the span\_near query.

--  
Ivan

On Mon, Apr 28, 2014 at 7:05 PM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com) wrote:

> Hi Ivan,
> 
> Not able to get any result with the following query :
> 
> {  
> "from" : 100,  
> "size" : 100,  
> "query" : {  
> "span\_first" : {  
> "match" : {  
> "span\_near" : {  
> "clauses" : [  
> { "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
> { "span\_term" : { "DISPLAY\_NAME" : "people" } }
> 
> ```
> ],
> "slop" : 1,
> "in_order" : true
> }
> },
> "end" : 1
> }
> 
> ```
> 
> }  
> }
> 
> Meanwhile tried with :
> 
> {  
> "from" : 100,  
> "size" : 100,  
> "query" : {  
> "span\_first" : {  
> "match" : {  
> "span\_term" : { "DISPLAY\_NAME" : "happy" }  
> },  
> "end" : 1  
> }  
> }  
> }
> 
> and it returns :
> 
> ```
> "_index": "jdbc_dev",
> "_type": "media",
> "_id": "9556",
> "_score": 4.612431,
> "_source": {
> "DISPLAY_NAME": "Happy People",
> 
> ```
> 
> Anything wrong with my first query ?
> 
> Thanks
> 
> On Tue, Apr 29, 2014 at 12:16 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> 
> > The main limitation of the span queries is that they only operate on  
> > analyzed terms. The terms used in span\_term must match the terms in the  
> > index. In your case, there is no single term "happy holiday" in your index,  
> > because the original document was tokenized into "happy" "birthday" "to"  
> > "you".
> > 
> > You would need to do a span near query of the two terms with a slop of 1  
> > and in order. This span near query will then be the argument to the span  
> > first.
> > 
> > Here is a good explanation of span queries in Lucene:  
> > [http://searchhub.org/2009/07/18/the-spanquery/](http://searchhub.org/2009/07/18/the-spanquery/)
> > 
> > --  
> > Ivan
> > 
> > On Sun, Apr 27, 2014 at 11:24 PM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > 
> > > Hi Ivan,
> > > 
> > > I recreate the mapping and re-index the documents and now working fine.  
> > > Thanks.
> > > 
> > > Btw would like to ask how i could search two or more words in the  
> > > span\_first query as i need it to support the following searches :  
> > > 1)happy  
> > > 2)happy holiday  
> > > 3)happy birthday to you
> > > 
> > > {  
> > > "from" : 100,  
> > > "size" : 100,  
> > > "query" : {  
> > > "span\_first" : {  
> > > "match" : {  
> > > \* "span\_term" : { "DISPLAY\_NAME" : "happy holiday" }\*  
> > > },  
> > > "end" : 1  
> > > }  
> > > }  
> > > }
> > > 
> > > returns empty list even we have documents that display\_name start with _happy  
> > > holiday_.
> > > 
> > > Thanks.
> > > 
> > > On Sunday, April 27, 2014 2:55:37 AM UTC+8, cyrilforce wrote:
> > > 
> > > > Hi Ivan,
> > > > 
> > > > I am using version elasticsearch-0.90.1. Nope we don't have any  
> > > > templates. Not sure whether your are referring to the full index mapping  
> > > > here's the gist
> > > > 
> > > > media mapping  
> > > > [span\_first\_issue\_media\_mapping.json · GitHub](https://gist.github.com/cheehoo/11327970)
> > > > 
> > > > full index mapping  
> > > > [span\_first\_issue\_full\_index\_mappping.json · GitHub](https://gist.github.com/cheehoo/11327996)
> > > > 
> > > > Thanks in advance.
> > > > 
> > > > On Sat, Apr 26, 2014 at 8:31 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > > > 
> > > > > Your mapping looks correct. Which version are you running? Do you have  
> > > > > any templates?
> > > > > 
> > > > > Just to be on the safe side, can you provide the mapping that  
> > > > > Elasticsearch is using (not the one you provide):
> > > > > 
> > > > > [http://localhost:9200/jdbc\_dev/media/\_mapping](http://localhost:9200/jdbc_dev/media/_mapping)
> > > > > 
> > > > > --  
> > > > > Ivan
> > > > > 
> > > > > On Fri, Apr 25, 2014 at 3:24 AM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > I am trying to query some records via the span\_first query as below :
> > > > > > 
> > > > > > {  
> > > > > > "from" : 100,  
> > > > > > "size" : 100,  
> > > > > > "query" : {  
> > > > > > "span\_first" : {  
> > > > > > "match" : {  
> > > > > > \* "span\_term" : { "DISPLAY\_NAME" : "happy" }\*  
> > > > > > },  
> > > > > > "end" : 1  
> > > > > > }  
> > > > > > }  
> > > > > > }
> > > > > > 
> > > > > > however it returned me with an error :
> > > > > > 
> > > > > > ```
> > > > > > "index": "jdbc_dev",
> > > > > > "shard": 4,
> > > > > > "status": 500,
> > > > > > * "reason":
> > > > > > 
> > > > > > ```
> > > > > > 
> > > > > > "RemoteTransportException[[portal-web-02][inet[/192.168.96.27:9300]][search/phase/query/id]];  
> > > > > > nested: QueryPhaseExecutionException[[jdbc\_dev][4]:  
> > > > > > query[filtered(spanFirst(DISPLAY\_NAME:happy,  
> > > > > > 1))-\>cache(\_type:media)],from[100],size[100]: Query Failed [Failed to  
> > > > > > execute main query]]; nested: IllegalStateException[field "DISPLAY\_NAME"  
> > > > > > was indexed without position data; cannot run SpanTermQuery (term=happy)];  
> > > > > > "\*  
> > > > > > }
> > > > > > 
> > > > > > The mapping for that type :
> > > > > > 
> > > > > > {  
> > > > > > "media": {  
> > > > > > "properties": {  
> > > > > > "AUDIO": {  
> > > > > > "type": "string"  
> > > > > > },  
> > > > > > "BILLINGTYPE\_ID": {  
> > > > > > "type": "long"  
> > > > > > },  
> > > > > > "CATMEDIA\_CDATE": {  
> > > > > > "type": "date",  
> > > > > > "format": "dateOptionalTime"  
> > > > > > },  
> > > > > > "CATMEDIA\_NAME": {  
> > > > > > "type": "string"  
> > > > > > },  
> > > > > > "CATMEDIA\_RANK": {  
> > > > > > "type": "long"  
> > > > > > },  
> > > > > > "CAT\_ID": {  
> > > > > > "type": "long"  
> > > > > > },  
> > > > > > "CAT\_NAME": {  
> > > > > > "type": "string",  
> > > > > > "analyzer": "string\_lowercase",  
> > > > > > "include\_in\_all": true  
> > > > > > },  
> > > > > > "CAT\_PARENT": {  
> > > > > > "type": "long"  
> > > > > > },  
> > > > > > "CHANNEL\_ID": {  
> > > > > > "type": "long"  
> > > > > > },  
> > > > > > "CKEY": {  
> > > > > > "type": "long"  
> > > > > > },  
> > > > > > \* "DISPLAY\_NAME": {\*
> > > > > > 
> > > > > > - 
> > > > > > 
> > > > > > ```
> > > > > > "type": "string",*
> > > > > > 
> > > > > > ```
> > > > > > 
> > > > > > - 
> > > > > > 
> > > > > > ```
> > > > > > "analyzer": "standard"*
> > > > > > 
> > > > > > ```
> > > > > > 
> > > > > > - 
> > > > > > 
> > > > > > ```
> > > > > > },*
> > > > > > "FTID": {
> > > > > > "type": "string"
> > > > > > },
> > > > > > "GENRE": {
> > > > > > "type": "string"
> > > > > > },
> > > > > > "ITEMCODE": {
> > > > > > "type": "string"
> > > > > > },
> > > > > > "KEYWORDS": {
> > > > > > "type": "string"
> > > > > > },
> > > > > > "LANG_ID": {
> > > > > > "type": "long"
> > > > > > },
> > > > > > "LONG_DESCRIPTION": {
> > > > > > "type": "string"
> > > > > > },
> > > > > > "MAPPINGS": {
> > > > > > "type": "string",
> > > > > > "analyzer": "string_lowercase",
> > > > > > "include_in_all": true
> > > > > > },
> > > > > > "MEDIA_ID": {
> > > > > > "type": "long"
> > > > > > },
> > > > > > "MEDIA_PKEY": {
> > > > > > "type": "string"
> > > > > > },
> > > > > > "PERFORMER": {
> > > > > > "type": "string"
> > > > > > },
> > > > > > "PLAYER": {
> > > > > > "type": "string"
> > > > > > },
> > > > > > "POSITION": {
> > > > > > "type": "long"
> > > > > > },
> > > > > > "PRICE": {
> > > > > > "type": "double"
> > > > > > },
> > > > > > "PRIORITY": {
> > > > > > "type": "long"
> > > > > > },
> > > > > > "SHORTCODE": {
> > > > > > "type": "string"
> > > > > > },
> > > > > > "SHORT_DESCRIPTION": {
> > > > > > "type": "string"
> > > > > > },
> > > > > > "TYPE_ID": {
> > > > > > "type": "long"
> > > > > > },
> > > > > > "VIEW_ID": {
> > > > > > "type": "long"
> > > > > > }
> > > > > > }
> > > > > > 
> > > > > > ```
> > > > > > 
> > > > > > }  
> > > > > > }
> > > > > > 
> > > > > > I would like to know what is the reason and how i could fix it.  
> > > > > > Thanks.
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to the Google  
> > > > > > Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > > > > > 
> > > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > > msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%  
> > > > > > [40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > .  
> > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to a topic in the  
> > > > > Google Groups "elasticsearch" group.  
> > > > > To unsubscribe from this topic, visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > topic/elasticsearch/cwzQrR1Rpsw/unsubscribe.  
> > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%  
> > > > > 3DvHY0y4qkHdcHrR57nGEc0f1haAw%[40mail.gmail.com](http://40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > .
> > > > > 
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > Regards,
> > > > 
> > > > Chee Hoo
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Regards,
> 
> Chee Hoo
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY\_eHFO\_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY_eHFO_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY\_eHFO\_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY_eHFO_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG\_L\_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG_L_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![cyrilforce](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cyrilforce](https://discuss.elastic.co/u/cyrilforce)\
**Post date:** [April 30, 2014, 2:21am UTC](https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194/8 "2014-04-30T02:21:09Z")

</div>

Hi Ivan,

Tried with 2 and 3 with no luck.

{  
"from" : 100,  
"size" : 100,  
"query" : {  
"span\_first" : {  
"match" : {  
"span\_near" : {  
"clauses" : [  
{ "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
{ "span\_term" : { "DISPLAY\_NAME" : "people" } }

```
    ],
    "slop" : 1,
    "in_order" : true
}
    },
    *"end" : 2*
}

```

}  
}

The field is using "standard" analyzer with stopword=\_none:

"DISPLAY\_NAME": {  
"type": "string",  
"analyzer": "standard"  
},

"index.analysis.analyzer.standard.type": "standard",  
"index.analysis.analyzer.standard.stopwords": "_none_"

Any clue on this ? 🙂 Thanks

On Wed, Apr 30, 2014 at 12:37 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> The end parameter is too low. It needs to be at a minimum the number of  
> clauses in the span\_near query.
> 
> --  
> Ivan
> 
> On Mon, Apr 28, 2014 at 7:05 PM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com) wrote:
> 
> > Hi Ivan,
> > 
> > Not able to get any result with the following query :
> > 
> > {  
> > "from" : 100,  
> > "size" : 100,  
> > "query" : {  
> > "span\_first" : {  
> > "match" : {  
> > "span\_near" : {  
> > "clauses" : [  
> > { "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
> > { "span\_term" : { "DISPLAY\_NAME" : "people" } }
> > 
> > ```
> > ],
> > "slop" : 1,
> > "in_order" : true
> > }
> > },
> > "end" : 1
> > }
> > 
> > ```
> > 
> > }  
> > }
> > 
> > Meanwhile tried with :
> > 
> > {  
> > "from" : 100,  
> > "size" : 100,  
> > "query" : {  
> > "span\_first" : {  
> > "match" : {  
> > "span\_term" : { "DISPLAY\_NAME" : "happy" }  
> > },  
> > "end" : 1  
> > }  
> > }  
> > }
> > 
> > and it returns :
> > 
> > ```
> > "_index": "jdbc_dev",
> > "_type": "media",
> > "_id": "9556",
> > "_score": 4.612431,
> > "_source": {
> > "DISPLAY_NAME": "Happy People",
> > 
> > ```
> > 
> > Anything wrong with my first query ?
> > 
> > Thanks
> > 
> > On Tue, Apr 29, 2014 at 12:16 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > 
> > > The main limitation of the span queries is that they only operate on  
> > > analyzed terms. The terms used in span\_term must match the terms in the  
> > > index. In your case, there is no single term "happy holiday" in your index,  
> > > because the original document was tokenized into "happy" "birthday"  
> > > "to" "you".
> > > 
> > > You would need to do a span near query of the two terms with a slop of 1  
> > > and in order. This span near query will then be the argument to the span  
> > > first.
> > > 
> > > Here is a good explanation of span queries in Lucene:  
> > > [http://searchhub.org/2009/07/18/the-spanquery/](http://searchhub.org/2009/07/18/the-spanquery/)
> > > 
> > > --  
> > > Ivan
> > > 
> > > On Sun, Apr 27, 2014 at 11:24 PM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > 
> > > > Hi Ivan,
> > > > 
> > > > I recreate the mapping and re-index the documents and now working fine.  
> > > > Thanks.
> > > > 
> > > > Btw would like to ask how i could search two or more words in the  
> > > > span\_first query as i need it to support the following searches :  
> > > > 1)happy  
> > > > 2)happy holiday  
> > > > 3)happy birthday to you
> > > > 
> > > > {  
> > > > "from" : 100,  
> > > > "size" : 100,  
> > > > "query" : {  
> > > > "span\_first" : {  
> > > > "match" : {  
> > > > \* "span\_term" : { "DISPLAY\_NAME" : "happy holiday" }\*  
> > > > },  
> > > > "end" : 1  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > returns empty list even we have documents that display\_name start with _happy  
> > > > holiday_.
> > > > 
> > > > Thanks.
> > > > 
> > > > On Sunday, April 27, 2014 2:55:37 AM UTC+8, cyrilforce wrote:
> > > > 
> > > > > Hi Ivan,
> > > > > 
> > > > > I am using version elasticsearch-0.90.1. Nope we don't have any  
> > > > > templates. Not sure whether your are referring to the full index mapping  
> > > > > here's the gist
> > > > > 
> > > > > media mapping  
> > > > > [span\_first\_issue\_media\_mapping.json · GitHub](https://gist.github.com/cheehoo/11327970)
> > > > > 
> > > > > full index mapping  
> > > > > [span\_first\_issue\_full\_index\_mappping.json · GitHub](https://gist.github.com/cheehoo/11327996)
> > > > > 
> > > > > Thanks in advance.
> > > > > 
> > > > > On Sat, Apr 26, 2014 at 8:31 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > > > > 
> > > > > > Your mapping looks correct. Which version are you running? Do you  
> > > > > > have any templates?
> > > > > > 
> > > > > > Just to be on the safe side, can you provide the mapping that  
> > > > > > Elasticsearch is using (not the one you provide):
> > > > > > 
> > > > > > [http://localhost:9200/jdbc\_dev/media/\_mapping](http://localhost:9200/jdbc_dev/media/_mapping)
> > > > > > 
> > > > > > --  
> > > > > > Ivan
> > > > > > 
> > > > > > On Fri, Apr 25, 2014 at 3:24 AM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > > > 
> > > > > > > Hi,
> > > > > > > 
> > > > > > > I am trying to query some records via the span\_first query as below  
> > > > > > > :
> > > > > > > 
> > > > > > > {  
> > > > > > > "from" : 100,  
> > > > > > > "size" : 100,  
> > > > > > > "query" : {  
> > > > > > > "span\_first" : {  
> > > > > > > "match" : {  
> > > > > > > \* "span\_term" : { "DISPLAY\_NAME" : "happy" }\*  
> > > > > > > },  
> > > > > > > "end" : 1  
> > > > > > > }  
> > > > > > > }  
> > > > > > > }
> > > > > > > 
> > > > > > > however it returned me with an error :
> > > > > > > 
> > > > > > > ```
> > > > > > > "index": "jdbc_dev",
> > > > > > > "shard": 4,
> > > > > > > "status": 500,
> > > > > > > * "reason":
> > > > > > > 
> > > > > > > ```
> > > > > > > 
> > > > > > > "RemoteTransportException[[portal-web-02][inet[/192.168.96.27:9300]][search/phase/query/id]];  
> > > > > > > nested: QueryPhaseExecutionException[[jdbc\_dev][4]:  
> > > > > > > query[filtered(spanFirst(DISPLAY\_NAME:happy,  
> > > > > > > 1))-\>cache(\_type:media)],from[100],size[100]: Query Failed [Failed to  
> > > > > > > execute main query]]; nested: IllegalStateException[field "DISPLAY\_NAME"  
> > > > > > > was indexed without position data; cannot run SpanTermQuery (term=happy)];  
> > > > > > > "\*  
> > > > > > > }
> > > > > > > 
> > > > > > > The mapping for that type :
> > > > > > > 
> > > > > > > {  
> > > > > > > "media": {  
> > > > > > > "properties": {  
> > > > > > > "AUDIO": {  
> > > > > > > "type": "string"  
> > > > > > > },  
> > > > > > > "BILLINGTYPE\_ID": {  
> > > > > > > "type": "long"  
> > > > > > > },  
> > > > > > > "CATMEDIA\_CDATE": {  
> > > > > > > "type": "date",  
> > > > > > > "format": "dateOptionalTime"  
> > > > > > > },  
> > > > > > > "CATMEDIA\_NAME": {  
> > > > > > > "type": "string"  
> > > > > > > },  
> > > > > > > "CATMEDIA\_RANK": {  
> > > > > > > "type": "long"  
> > > > > > > },  
> > > > > > > "CAT\_ID": {  
> > > > > > > "type": "long"  
> > > > > > > },  
> > > > > > > "CAT\_NAME": {  
> > > > > > > "type": "string",  
> > > > > > > "analyzer": "string\_lowercase",  
> > > > > > > "include\_in\_all": true  
> > > > > > > },  
> > > > > > > "CAT\_PARENT": {  
> > > > > > > "type": "long"  
> > > > > > > },  
> > > > > > > "CHANNEL\_ID": {  
> > > > > > > "type": "long"  
> > > > > > > },  
> > > > > > > "CKEY": {  
> > > > > > > "type": "long"  
> > > > > > > },  
> > > > > > > \* "DISPLAY\_NAME": {\*
> > > > > > > 
> > > > > > > - 
> > > > > > > 
> > > > > > > ```
> > > > > > > "type": "string",*
> > > > > > > 
> > > > > > > ```
> > > > > > > 
> > > > > > > - 
> > > > > > > 
> > > > > > > ```
> > > > > > > "analyzer": "standard"*
> > > > > > > 
> > > > > > > ```
> > > > > > > 
> > > > > > > - 
> > > > > > > 
> > > > > > > ```
> > > > > > > },*
> > > > > > > "FTID": {
> > > > > > > "type": "string"
> > > > > > > },
> > > > > > > "GENRE": {
> > > > > > > "type": "string"
> > > > > > > },
> > > > > > > "ITEMCODE": {
> > > > > > > "type": "string"
> > > > > > > },
> > > > > > > "KEYWORDS": {
> > > > > > > "type": "string"
> > > > > > > },
> > > > > > > "LANG_ID": {
> > > > > > > "type": "long"
> > > > > > > },
> > > > > > > "LONG_DESCRIPTION": {
> > > > > > > "type": "string"
> > > > > > > },
> > > > > > > "MAPPINGS": {
> > > > > > > "type": "string",
> > > > > > > "analyzer": "string_lowercase",
> > > > > > > "include_in_all": true
> > > > > > > },
> > > > > > > "MEDIA_ID": {
> > > > > > > "type": "long"
> > > > > > > },
> > > > > > > "MEDIA_PKEY": {
> > > > > > > "type": "string"
> > > > > > > },
> > > > > > > "PERFORMER": {
> > > > > > > "type": "string"
> > > > > > > },
> > > > > > > "PLAYER": {
> > > > > > > "type": "string"
> > > > > > > },
> > > > > > > "POSITION": {
> > > > > > > "type": "long"
> > > > > > > },
> > > > > > > "PRICE": {
> > > > > > > "type": "double"
> > > > > > > },
> > > > > > > "PRIORITY": {
> > > > > > > "type": "long"
> > > > > > > },
> > > > > > > "SHORTCODE": {
> > > > > > > "type": "string"
> > > > > > > },
> > > > > > > "SHORT_DESCRIPTION": {
> > > > > > > "type": "string"
> > > > > > > },
> > > > > > > "TYPE_ID": {
> > > > > > > "type": "long"
> > > > > > > },
> > > > > > > "VIEW_ID": {
> > > > > > > "type": "long"
> > > > > > > }
> > > > > > > }
> > > > > > > 
> > > > > > > ```
> > > > > > > 
> > > > > > > }  
> > > > > > > }
> > > > > > > 
> > > > > > > I would like to know what is the reason and how i could fix it.  
> > > > > > > Thanks.
> > > > > > > 
> > > > > > > --  
> > > > > > > You received this message because you are subscribed to the Google  
> > > > > > > Groups "elasticsearch" group.  
> > > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > > send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > > > > > > 
> > > > > > > To view this discussion on the web visit  
> > > > > > > [https://groups.google.com/d/msgid/elasticsearch/ad8740af-](https://groups.google.com/d/msgid/elasticsearch/ad8740af-)  
> > > > > > > 2038-40d4-9fc2-79d6e1402e5a%[40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > > .  
> > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to a topic in  
> > > > > > the Google Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this topic, visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > > topic/elasticsearch/cwzQrR1Rpsw/unsubscribe.  
> > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > > msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%  
> > > > > > 3DvHY0y4qkHdcHrR57nGEc0f1haAw%[40mail.gmail.com](http://40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > > .
> > > > > > 
> > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > 
> > > > > --  
> > > > > Regards,
> > > > > 
> > > > > Chee Hoo
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > Regards,
> > 
> > Chee Hoo
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY\_eHFO\_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY_eHFO_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY\_eHFO\_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY_eHFO_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG\_L\_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG_L_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG\_L\_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG_L_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Regards,

Chee Hoo

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC\_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [April 30, 2014, 4:04am UTC](https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194/9 "2014-04-30T04:04:12Z")

</div>

Do you have any documents that starts with "happy people"?

--  
Ivan

On Tue, Apr 29, 2014 at 7:21 PM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com) wrote:

> Hi Ivan,
> 
> Tried with 2 and 3 with no luck.
> 
> {  
> "from" : 100,  
> "size" : 100,  
> "query" : {  
> "span\_first" : {  
> "match" : {  
> "span\_near" : {  
> "clauses" : [  
> { "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
> { "span\_term" : { "DISPLAY\_NAME" : "people" } }
> 
> ```
> ],
> "slop" : 1,
> "in_order" : true
> }
> },
> *"end" : 2*
> }
> 
> ```
> 
> }  
> }
> 
> The field is using "standard" analyzer with stopword=\_none:
> 
> "DISPLAY\_NAME": {  
> "type": "string",  
> "analyzer": "standard"  
> },
> 
> "index.analysis.analyzer.standard.type": "standard",  
> "index.analysis.analyzer.standard.stopwords": "_none_"
> 
> Any clue on this ? 🙂 Thanks
> 
> On Wed, Apr 30, 2014 at 12:37 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> 
> > The end parameter is too low. It needs to be at a minimum the number of  
> > clauses in the span\_near query.
> > 
> > --  
> > Ivan
> > 
> > On Mon, Apr 28, 2014 at 7:05 PM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > 
> > > Hi Ivan,
> > > 
> > > Not able to get any result with the following query :
> > > 
> > > {  
> > > "from" : 100,  
> > > "size" : 100,  
> > > "query" : {  
> > > "span\_first" : {  
> > > "match" : {  
> > > "span\_near" : {  
> > > "clauses" : [  
> > > { "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
> > > { "span\_term" : { "DISPLAY\_NAME" : "people" } }
> > > 
> > > ```
> > > ],
> > > "slop" : 1,
> > > "in_order" : true
> > > }
> > > },
> > > "end" : 1
> > > }
> > > 
> > > ```
> > > 
> > > }  
> > > }
> > > 
> > > Meanwhile tried with :
> > > 
> > > {  
> > > "from" : 100,  
> > > "size" : 100,  
> > > "query" : {  
> > > "span\_first" : {  
> > > "match" : {  
> > > "span\_term" : { "DISPLAY\_NAME" : "happy" }  
> > > },  
> > > "end" : 1  
> > > }  
> > > }  
> > > }
> > > 
> > > and it returns :
> > > 
> > > ```
> > > "_index": "jdbc_dev",
> > > "_type": "media",
> > > "_id": "9556",
> > > "_score": 4.612431,
> > > "_source": {
> > > "DISPLAY_NAME": "Happy People",
> > > 
> > > ```
> > > 
> > > Anything wrong with my first query ?
> > > 
> > > Thanks
> > > 
> > > On Tue, Apr 29, 2014 at 12:16 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > > 
> > > > The main limitation of the span queries is that they only operate on  
> > > > analyzed terms. The terms used in span\_term must match the terms in the  
> > > > index. In your case, there is no single term "happy holiday" in your index,  
> > > > because the original document was tokenized into "happy" "birthday"  
> > > > "to" "you".
> > > > 
> > > > You would need to do a span near query of the two terms with a slop of  
> > > > 1 and in order. This span near query will then be the argument to the span  
> > > > first.
> > > > 
> > > > Here is a good explanation of span queries in Lucene:  
> > > > [http://searchhub.org/2009/07/18/the-spanquery/](http://searchhub.org/2009/07/18/the-spanquery/)
> > > > 
> > > > --  
> > > > Ivan
> > > > 
> > > > On Sun, Apr 27, 2014 at 11:24 PM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > 
> > > > > Hi Ivan,
> > > > > 
> > > > > I recreate the mapping and re-index the documents and now working  
> > > > > fine. Thanks.
> > > > > 
> > > > > Btw would like to ask how i could search two or more words in the  
> > > > > span\_first query as i need it to support the following searches :  
> > > > > 1)happy  
> > > > > 2)happy holiday  
> > > > > 3)happy birthday to you
> > > > > 
> > > > > {  
> > > > > "from" : 100,  
> > > > > "size" : 100,  
> > > > > "query" : {  
> > > > > "span\_first" : {  
> > > > > "match" : {  
> > > > > \* "span\_term" : { "DISPLAY\_NAME" : "happy holiday" }\*  
> > > > > },  
> > > > > "end" : 1  
> > > > > }  
> > > > > }  
> > > > > }
> > > > > 
> > > > > returns empty list even we have documents that display\_name start with _happy  
> > > > > holiday_.
> > > > > 
> > > > > Thanks.
> > > > > 
> > > > > On Sunday, April 27, 2014 2:55:37 AM UTC+8, cyrilforce wrote:
> > > > > 
> > > > > > Hi Ivan,
> > > > > > 
> > > > > > I am using version elasticsearch-0.90.1. Nope we don't have any  
> > > > > > templates. Not sure whether your are referring to the full index mapping  
> > > > > > here's the gist
> > > > > > 
> > > > > > media mapping  
> > > > > > [span\_first\_issue\_media\_mapping.json · GitHub](https://gist.github.com/cheehoo/11327970)
> > > > > > 
> > > > > > full index mapping  
> > > > > > [span\_first\_issue\_full\_index\_mappping.json · GitHub](https://gist.github.com/cheehoo/11327996)
> > > > > > 
> > > > > > Thanks in advance.
> > > > > > 
> > > > > > On Sat, Apr 26, 2014 at 8:31 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > > > > > 
> > > > > > > Your mapping looks correct. Which version are you running? Do you  
> > > > > > > have any templates?
> > > > > > > 
> > > > > > > Just to be on the safe side, can you provide the mapping that  
> > > > > > > Elasticsearch is using (not the one you provide):
> > > > > > > 
> > > > > > > [http://localhost:9200/jdbc\_dev/media/\_mapping](http://localhost:9200/jdbc_dev/media/_mapping)
> > > > > > > 
> > > > > > > --  
> > > > > > > Ivan
> > > > > > > 
> > > > > > > On Fri, Apr 25, 2014 at 3:24 AM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > > > > 
> > > > > > > > Hi,
> > > > > > > > 
> > > > > > > > I am trying to query some records via the span\_first query as below  
> > > > > > > > :
> > > > > > > > 
> > > > > > > > {  
> > > > > > > > "from" : 100,  
> > > > > > > > "size" : 100,  
> > > > > > > > "query" : {  
> > > > > > > > "span\_first" : {  
> > > > > > > > "match" : {  
> > > > > > > > \* "span\_term" : { "DISPLAY\_NAME" : "happy" }\*  
> > > > > > > > },  
> > > > > > > > "end" : 1  
> > > > > > > > }  
> > > > > > > > }  
> > > > > > > > }
> > > > > > > > 
> > > > > > > > however it returned me with an error :
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > "index": "jdbc_dev",
> > > > > > > > "shard": 4,
> > > > > > > > "status": 500,
> > > > > > > > * "reason":
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > 
> > > > > > > > "RemoteTransportException[[portal-web-02][inet[/192.168.96.27:9300]][search/phase/query/id]];  
> > > > > > > > nested: QueryPhaseExecutionException[[jdbc\_dev][4]:  
> > > > > > > > query[filtered(spanFirst(DISPLAY\_NAME:happy,  
> > > > > > > > 1))-\>cache(\_type:media)],from[100],size[100]: Query Failed [Failed to  
> > > > > > > > execute main query]]; nested: IllegalStateException[field "DISPLAY\_NAME"  
> > > > > > > > was indexed without position data; cannot run SpanTermQuery (term=happy)];  
> > > > > > > > "\*  
> > > > > > > > }
> > > > > > > > 
> > > > > > > > The mapping for that type :
> > > > > > > > 
> > > > > > > > {  
> > > > > > > > "media": {  
> > > > > > > > "properties": {  
> > > > > > > > "AUDIO": {  
> > > > > > > > "type": "string"  
> > > > > > > > },  
> > > > > > > > "BILLINGTYPE\_ID": {  
> > > > > > > > "type": "long"  
> > > > > > > > },  
> > > > > > > > "CATMEDIA\_CDATE": {  
> > > > > > > > "type": "date",  
> > > > > > > > "format": "dateOptionalTime"  
> > > > > > > > },  
> > > > > > > > "CATMEDIA\_NAME": {  
> > > > > > > > "type": "string"  
> > > > > > > > },  
> > > > > > > > "CATMEDIA\_RANK": {  
> > > > > > > > "type": "long"  
> > > > > > > > },  
> > > > > > > > "CAT\_ID": {  
> > > > > > > > "type": "long"  
> > > > > > > > },  
> > > > > > > > "CAT\_NAME": {  
> > > > > > > > "type": "string",  
> > > > > > > > "analyzer": "string\_lowercase",  
> > > > > > > > "include\_in\_all": true  
> > > > > > > > },  
> > > > > > > > "CAT\_PARENT": {  
> > > > > > > > "type": "long"  
> > > > > > > > },  
> > > > > > > > "CHANNEL\_ID": {  
> > > > > > > > "type": "long"  
> > > > > > > > },  
> > > > > > > > "CKEY": {  
> > > > > > > > "type": "long"  
> > > > > > > > },  
> > > > > > > > \* "DISPLAY\_NAME": {\*
> > > > > > > > 
> > > > > > > > - 
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > "type": "string",*
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > 
> > > > > > > > - 
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > "analyzer": "standard"*
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > 
> > > > > > > > - 
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > },*
> > > > > > > > "FTID": {
> > > > > > > > "type": "string"
> > > > > > > > },
> > > > > > > > "GENRE": {
> > > > > > > > "type": "string"
> > > > > > > > },
> > > > > > > > "ITEMCODE": {
> > > > > > > > "type": "string"
> > > > > > > > },
> > > > > > > > "KEYWORDS": {
> > > > > > > > "type": "string"
> > > > > > > > },
> > > > > > > > "LANG_ID": {
> > > > > > > > "type": "long"
> > > > > > > > },
> > > > > > > > "LONG_DESCRIPTION": {
> > > > > > > > "type": "string"
> > > > > > > > },
> > > > > > > > "MAPPINGS": {
> > > > > > > > "type": "string",
> > > > > > > > "analyzer": "string_lowercase",
> > > > > > > > "include_in_all": true
> > > > > > > > },
> > > > > > > > "MEDIA_ID": {
> > > > > > > > "type": "long"
> > > > > > > > },
> > > > > > > > "MEDIA_PKEY": {
> > > > > > > > "type": "string"
> > > > > > > > },
> > > > > > > > "PERFORMER": {
> > > > > > > > "type": "string"
> > > > > > > > },
> > > > > > > > "PLAYER": {
> > > > > > > > "type": "string"
> > > > > > > > },
> > > > > > > > "POSITION": {
> > > > > > > > "type": "long"
> > > > > > > > },
> > > > > > > > "PRICE": {
> > > > > > > > "type": "double"
> > > > > > > > },
> > > > > > > > "PRIORITY": {
> > > > > > > > "type": "long"
> > > > > > > > },
> > > > > > > > "SHORTCODE": {
> > > > > > > > "type": "string"
> > > > > > > > },
> > > > > > > > "SHORT_DESCRIPTION": {
> > > > > > > > "type": "string"
> > > > > > > > },
> > > > > > > > "TYPE_ID": {
> > > > > > > > "type": "long"
> > > > > > > > },
> > > > > > > > "VIEW_ID": {
> > > > > > > > "type": "long"
> > > > > > > > }
> > > > > > > > }
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > 
> > > > > > > > }  
> > > > > > > > }
> > > > > > > > 
> > > > > > > > I would like to know what is the reason and how i could fix it.  
> > > > > > > > Thanks.
> > > > > > > > 
> > > > > > > > --  
> > > > > > > > You received this message because you are subscribed to the Google  
> > > > > > > > Groups "elasticsearch" group.  
> > > > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > > > send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > > > > > > > 
> > > > > > > > To view this discussion on the web visit  
> > > > > > > > [https://groups.google.com/d/msgid/elasticsearch/ad8740af-](https://groups.google.com/d/msgid/elasticsearch/ad8740af-)  
> > > > > > > > 2038-40d4-9fc2-79d6e1402e5a%[40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > > > .  
> > > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > > 
> > > > > > > --  
> > > > > > > You received this message because you are subscribed to a topic in  
> > > > > > > the Google Groups "elasticsearch" group.  
> > > > > > > To unsubscribe from this topic, visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > > > topic/elasticsearch/cwzQrR1Rpsw/unsubscribe.  
> > > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > > To view this discussion on the web visit  
> > > > > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%](https://groups.google.com/d/msgid/elasticsearch/CALY%25)  
> > > > > > > 3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%[40mail.gmail.com](http://40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > > > .
> > > > > > > 
> > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > 
> > > > > > --  
> > > > > > Regards,
> > > > > > 
> > > > > > Chee Hoo
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to the Google  
> > > > > Groups "elasticsearch" group.  
> > > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > .
> > > > > 
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit  
> > > > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, send an email to  
> > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > Regards,
> > > 
> > > Chee Hoo
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY\_eHFO\_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY_eHFO_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY\_eHFO\_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY_eHFO_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG\_L\_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG_L_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG\_L\_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG_L_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Regards,
> 
> Chee Hoo
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC\_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC\_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![cyrilforce](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cyrilforce](https://discuss.elastic.co/u/cyrilforce)\
**Post date:** [April 30, 2014, 5:59am UTC](https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194/10 "2014-04-30T05:59:26Z")

</div>

Hi Ivan,

Running the following query it returns records below :

{  
"query" : { "match" : {"DISPLAY\_NAME" : "Happy People"} }  
}

Result :

> <https://gist.github.com/cheehoo/073ab926baa123b18224>

but running with span query suggested:

{  
"from" : 100,  
"size" : 100,  
"query" : {  
"span\_first" : {  
"match" : {  
"span\_near" : {  
"clauses" : [  
{ "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
{ "span\_term" : { "DISPLAY\_NAME" : "people" } }

```
     ],
     "slop" : 1,
     "in_order" : true
 }
    },
    *"end" : 2*
}

```

}  
}

no result returned.

Any clues 🙂

Thanks.

On Wed, Apr 30, 2014 at 12:04 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Do you have any documents that starts with "happy people"?
> 
> --  
> Ivan
> 
> On Tue, Apr 29, 2014 at 7:21 PM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com) wrote:
> 
> > Hi Ivan,
> > 
> > Tried with 2 and 3 with no luck.
> > 
> > {  
> > "from" : 100,  
> > "size" : 100,  
> > "query" : {  
> > "span\_first" : {  
> > "match" : {  
> > "span\_near" : {  
> > "clauses" : [  
> > { "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
> > { "span\_term" : { "DISPLAY\_NAME" : "people" } }
> > 
> > ```
> > ],
> > "slop" : 1,
> > "in_order" : true
> > }
> > },
> > *"end" : 2*
> > }
> > 
> > ```
> > 
> > }  
> > }
> > 
> > The field is using "standard" analyzer with stopword=\_none:
> > 
> > "DISPLAY\_NAME": {  
> > "type": "string",  
> > "analyzer": "standard"  
> > },
> > 
> > "index.analysis.analyzer.standard.type": "standard",  
> > "index.analysis.analyzer.standard.stopwords": "_none_"
> > 
> > Any clue on this ? 🙂 Thanks
> > 
> > On Wed, Apr 30, 2014 at 12:37 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > 
> > > The end parameter is too low. It needs to be at a minimum the number of  
> > > clauses in the span\_near query.
> > > 
> > > --  
> > > Ivan
> > > 
> > > On Mon, Apr 28, 2014 at 7:05 PM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > 
> > > > Hi Ivan,
> > > > 
> > > > Not able to get any result with the following query :
> > > > 
> > > > {  
> > > > "from" : 100,  
> > > > "size" : 100,  
> > > > "query" : {  
> > > > "span\_first" : {  
> > > > "match" : {  
> > > > "span\_near" : {  
> > > > "clauses" : [  
> > > > { "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
> > > > { "span\_term" : { "DISPLAY\_NAME" : "people" } }
> > > > 
> > > > ```
> > > > ],
> > > > "slop" : 1,
> > > > "in_order" : true
> > > > }
> > > > },
> > > > "end" : 1
> > > > }
> > > > 
> > > > ```
> > > > 
> > > > }  
> > > > }
> > > > 
> > > > Meanwhile tried with :
> > > > 
> > > > {  
> > > > "from" : 100,  
> > > > "size" : 100,  
> > > > "query" : {  
> > > > "span\_first" : {  
> > > > "match" : {  
> > > > "span\_term" : { "DISPLAY\_NAME" : "happy" }  
> > > > },  
> > > > "end" : 1  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > and it returns :
> > > > 
> > > > ```
> > > > "_index": "jdbc_dev",
> > > > "_type": "media",
> > > > "_id": "9556",
> > > > "_score": 4.612431,
> > > > "_source": {
> > > > "DISPLAY_NAME": "Happy People",
> > > > 
> > > > ```
> > > > 
> > > > Anything wrong with my first query ?
> > > > 
> > > > Thanks
> > > > 
> > > > On Tue, Apr 29, 2014 at 12:16 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > > > 
> > > > > The main limitation of the span queries is that they only operate on  
> > > > > analyzed terms. The terms used in span\_term must match the terms in the  
> > > > > index. In your case, there is no single term "happy holiday" in your index,  
> > > > > because the original document was tokenized into "happy" "birthday"  
> > > > > "to" "you".
> > > > > 
> > > > > You would need to do a span near query of the two terms with a slop of  
> > > > > 1 and in order. This span near query will then be the argument to the span  
> > > > > first.
> > > > > 
> > > > > Here is a good explanation of span queries in Lucene:  
> > > > > [http://searchhub.org/2009/07/18/the-spanquery/](http://searchhub.org/2009/07/18/the-spanquery/)
> > > > > 
> > > > > --  
> > > > > Ivan
> > > > > 
> > > > > On Sun, Apr 27, 2014 at 11:24 PM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > > 
> > > > > > Hi Ivan,
> > > > > > 
> > > > > > I recreate the mapping and re-index the documents and now working  
> > > > > > fine. Thanks.
> > > > > > 
> > > > > > Btw would like to ask how i could search two or more words in the  
> > > > > > span\_first query as i need it to support the following searches :  
> > > > > > 1)happy  
> > > > > > 2)happy holiday  
> > > > > > 3)happy birthday to you
> > > > > > 
> > > > > > {  
> > > > > > "from" : 100,  
> > > > > > "size" : 100,  
> > > > > > "query" : {  
> > > > > > "span\_first" : {  
> > > > > > "match" : {  
> > > > > > \* "span\_term" : { "DISPLAY\_NAME" : "happy holiday" }\*  
> > > > > > },  
> > > > > > "end" : 1  
> > > > > > }  
> > > > > > }  
> > > > > > }
> > > > > > 
> > > > > > returns empty list even we have documents that display\_name start  
> > > > > > with _happy holiday_.
> > > > > > 
> > > > > > Thanks.
> > > > > > 
> > > > > > On Sunday, April 27, 2014 2:55:37 AM UTC+8, cyrilforce wrote:
> > > > > > 
> > > > > > > Hi Ivan,
> > > > > > > 
> > > > > > > I am using version elasticsearch-0.90.1. Nope we don't have any  
> > > > > > > templates. Not sure whether your are referring to the full index mapping  
> > > > > > > here's the gist
> > > > > > > 
> > > > > > > media mapping  
> > > > > > > [span\_first\_issue\_media\_mapping.json · GitHub](https://gist.github.com/cheehoo/11327970)
> > > > > > > 
> > > > > > > full index mapping  
> > > > > > > [span\_first\_issue\_full\_index\_mappping.json · GitHub](https://gist.github.com/cheehoo/11327996)
> > > > > > > 
> > > > > > > Thanks in advance.
> > > > > > > 
> > > > > > > On Sat, Apr 26, 2014 at 8:31 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com)wrote:
> > > > > > > 
> > > > > > > > Your mapping looks correct. Which version are you running? Do you  
> > > > > > > > have any templates?
> > > > > > > > 
> > > > > > > > Just to be on the safe side, can you provide the mapping that  
> > > > > > > > Elasticsearch is using (not the one you provide):
> > > > > > > > 
> > > > > > > > [http://localhost:9200/jdbc\_dev/media/\_mapping](http://localhost:9200/jdbc_dev/media/_mapping)
> > > > > > > > 
> > > > > > > > --  
> > > > > > > > Ivan
> > > > > > > > 
> > > > > > > > On Fri, Apr 25, 2014 at 3:24 AM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > > > > > 
> > > > > > > > > Hi,
> > > > > > > > > 
> > > > > > > > > I am trying to query some records via the span\_first query as  
> > > > > > > > > below :
> > > > > > > > > 
> > > > > > > > > {  
> > > > > > > > > "from" : 100,  
> > > > > > > > > "size" : 100,  
> > > > > > > > > "query" : {  
> > > > > > > > > "span\_first" : {  
> > > > > > > > > "match" : {  
> > > > > > > > > \* "span\_term" : { "DISPLAY\_NAME" : "happy" }\*  
> > > > > > > > > },  
> > > > > > > > > "end" : 1  
> > > > > > > > > }  
> > > > > > > > > }  
> > > > > > > > > }
> > > > > > > > > 
> > > > > > > > > however it returned me with an error :
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > "index": "jdbc_dev",
> > > > > > > > > "shard": 4,
> > > > > > > > > "status": 500,
> > > > > > > > > * "reason":
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > 
> > > > > > > > > "RemoteTransportException[[portal-web-02][inet[/192.168.96.27:9300]][search/phase/query/id]];  
> > > > > > > > > nested: QueryPhaseExecutionException[[jdbc\_dev][4]:  
> > > > > > > > > query[filtered(spanFirst(DISPLAY\_NAME:happy,  
> > > > > > > > > 1))-\>cache(\_type:media)],from[100],size[100]: Query Failed [Failed to  
> > > > > > > > > execute main query]]; nested: IllegalStateException[field "DISPLAY\_NAME"  
> > > > > > > > > was indexed without position data; cannot run SpanTermQuery (term=happy)];  
> > > > > > > > > "\*  
> > > > > > > > > }
> > > > > > > > > 
> > > > > > > > > The mapping for that type :
> > > > > > > > > 
> > > > > > > > > {  
> > > > > > > > > "media": {  
> > > > > > > > > "properties": {  
> > > > > > > > > "AUDIO": {  
> > > > > > > > > "type": "string"  
> > > > > > > > > },  
> > > > > > > > > "BILLINGTYPE\_ID": {  
> > > > > > > > > "type": "long"  
> > > > > > > > > },  
> > > > > > > > > "CATMEDIA\_CDATE": {  
> > > > > > > > > "type": "date",  
> > > > > > > > > "format": "dateOptionalTime"  
> > > > > > > > > },  
> > > > > > > > > "CATMEDIA\_NAME": {  
> > > > > > > > > "type": "string"  
> > > > > > > > > },  
> > > > > > > > > "CATMEDIA\_RANK": {  
> > > > > > > > > "type": "long"  
> > > > > > > > > },  
> > > > > > > > > "CAT\_ID": {  
> > > > > > > > > "type": "long"  
> > > > > > > > > },  
> > > > > > > > > "CAT\_NAME": {  
> > > > > > > > > "type": "string",  
> > > > > > > > > "analyzer": "string\_lowercase",  
> > > > > > > > > "include\_in\_all": true  
> > > > > > > > > },  
> > > > > > > > > "CAT\_PARENT": {  
> > > > > > > > > "type": "long"  
> > > > > > > > > },  
> > > > > > > > > "CHANNEL\_ID": {  
> > > > > > > > > "type": "long"  
> > > > > > > > > },  
> > > > > > > > > "CKEY": {  
> > > > > > > > > "type": "long"  
> > > > > > > > > },  
> > > > > > > > > \* "DISPLAY\_NAME": {\*
> > > > > > > > > 
> > > > > > > > > - 
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > "type": "string",*
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > 
> > > > > > > > > - 
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > "analyzer": "standard"*
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > 
> > > > > > > > > - 
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > },*
> > > > > > > > > "FTID": {
> > > > > > > > > "type": "string"
> > > > > > > > > },
> > > > > > > > > "GENRE": {
> > > > > > > > > "type": "string"
> > > > > > > > > },
> > > > > > > > > "ITEMCODE": {
> > > > > > > > > "type": "string"
> > > > > > > > > },
> > > > > > > > > "KEYWORDS": {
> > > > > > > > > "type": "string"
> > > > > > > > > },
> > > > > > > > > "LANG_ID": {
> > > > > > > > > "type": "long"
> > > > > > > > > },
> > > > > > > > > "LONG_DESCRIPTION": {
> > > > > > > > > "type": "string"
> > > > > > > > > },
> > > > > > > > > "MAPPINGS": {
> > > > > > > > > "type": "string",
> > > > > > > > > "analyzer": "string_lowercase",
> > > > > > > > > "include_in_all": true
> > > > > > > > > },
> > > > > > > > > "MEDIA_ID": {
> > > > > > > > > "type": "long"
> > > > > > > > > },
> > > > > > > > > "MEDIA_PKEY": {
> > > > > > > > > "type": "string"
> > > > > > > > > },
> > > > > > > > > "PERFORMER": {
> > > > > > > > > "type": "string"
> > > > > > > > > },
> > > > > > > > > "PLAYER": {
> > > > > > > > > "type": "string"
> > > > > > > > > },
> > > > > > > > > "POSITION": {
> > > > > > > > > "type": "long"
> > > > > > > > > },
> > > > > > > > > "PRICE": {
> > > > > > > > > "type": "double"
> > > > > > > > > },
> > > > > > > > > "PRIORITY": {
> > > > > > > > > "type": "long"
> > > > > > > > > },
> > > > > > > > > "SHORTCODE": {
> > > > > > > > > "type": "string"
> > > > > > > > > },
> > > > > > > > > "SHORT_DESCRIPTION": {
> > > > > > > > > "type": "string"
> > > > > > > > > },
> > > > > > > > > "TYPE_ID": {
> > > > > > > > > "type": "long"
> > > > > > > > > },
> > > > > > > > > "VIEW_ID": {
> > > > > > > > > "type": "long"
> > > > > > > > > }
> > > > > > > > > }
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > 
> > > > > > > > > }  
> > > > > > > > > }
> > > > > > > > > 
> > > > > > > > > I would like to know what is the reason and how i could fix it.  
> > > > > > > > > Thanks.
> > > > > > > > > 
> > > > > > > > > --  
> > > > > > > > > You received this message because you are subscribed to the Google  
> > > > > > > > > Groups "elasticsearch" group.  
> > > > > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > > > > send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > > > > > > > > 
> > > > > > > > > To view this discussion on the web visit  
> > > > > > > > > [https://groups.google.com/d/msgid/elasticsearch/ad8740af-](https://groups.google.com/d/msgid/elasticsearch/ad8740af-)  
> > > > > > > > > 2038-40d4-9fc2-79d6e1402e5a%[40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > > > > .  
> > > > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > > > 
> > > > > > > > --  
> > > > > > > > You received this message because you are subscribed to a topic in  
> > > > > > > > the Google Groups "elasticsearch" group.  
> > > > > > > > To unsubscribe from this topic, visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > > > > topic/elasticsearch/cwzQrR1Rpsw/unsubscribe.  
> > > > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > > > To view this discussion on the web visit  
> > > > > > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%](https://groups.google.com/d/msgid/elasticsearch/CALY%25)  
> > > > > > > > 3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%[40mail.gmail.com](http://40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > > > > .
> > > > > > > > 
> > > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > > 
> > > > > > > --  
> > > > > > > Regards,
> > > > > > > 
> > > > > > > Chee Hoo
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to the Google  
> > > > > > Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > To view this discussion on the web visit  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > .
> > > > > > 
> > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to a topic in the  
> > > > > Google Groups "elasticsearch" group.  
> > > > > To unsubscribe from this topic, visit  
> > > > > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe)  
> > > > > .  
> > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > .
> > > > > 
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > Regards,
> > > > 
> > > > Chee Hoo
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY\_eHFO\_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY_eHFO_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY\_eHFO\_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY_eHFO_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG\_L\_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG_L_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG\_L\_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG_L_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > Regards,
> > 
> > Chee Hoo
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC\_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC\_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Regards,

Chee Hoo

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg\_vm-nbt%3D%2BcysQ7WJc0LXan\_hoF%3D%2BBLt%3DzC6H-dRVpYDQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg_vm-nbt%3D%2BcysQ7WJc0LXan_hoF%3D%2BBLt%3DzC6H-dRVpYDQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [April 30, 2014, 6:42am UTC](https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194/11 "2014-04-30T06:42:00Z")

</div>

You should provide a full curl recreation with your exact documents and  
mappings: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)

I have no issues executing a similar query. Note that the terms in  
span\_term are not analyzed, but that should not matter for those words  
using the standard analyzer.

--  
Ivan

On Tue, Apr 29, 2014 at 10:59 PM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com) wrote:

> Hi Ivan,
> 
> Running the following query it returns records below :
> 
> {  
> "query" : { "match" : {"DISPLAY\_NAME" : "Happy People"} }  
> }
> 
> Result :  
> [query\_match\_result.txt · GitHub](https://gist.github.com/cheehoo/073ab926baa123b18224)
> 
> but running with span query suggested:
> 
> {  
> "from" : 100,  
> "size" : 100,  
> "query" : {  
> "span\_first" : {  
> "match" : {  
> "span\_near" : {  
> "clauses" : [  
> { "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
> { "span\_term" : { "DISPLAY\_NAME" : "people" } }
> 
> ```
> ],
> "slop" : 1,
> "in_order" : true
> }
> },
> *"end" : 2*
> }
> 
> ```
> 
> }  
> }
> 
> no result returned.
> 
> Any clues 🙂
> 
> Thanks.
> 
> On Wed, Apr 30, 2014 at 12:04 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> 
> > Do you have any documents that starts with "happy people"?
> > 
> > --  
> > Ivan
> > 
> > On Tue, Apr 29, 2014 at 7:21 PM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > 
> > > Hi Ivan,
> > > 
> > > Tried with 2 and 3 with no luck.
> > > 
> > > {  
> > > "from" : 100,  
> > > "size" : 100,  
> > > "query" : {  
> > > "span\_first" : {  
> > > "match" : {  
> > > "span\_near" : {  
> > > "clauses" : [  
> > > { "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
> > > { "span\_term" : { "DISPLAY\_NAME" : "people" } }
> > > 
> > > ```
> > > ],
> > > "slop" : 1,
> > > "in_order" : true
> > > }
> > > },
> > > *"end" : 2*
> > > }
> > > 
> > > ```
> > > 
> > > }  
> > > }
> > > 
> > > The field is using "standard" analyzer with stopword=\_none:
> > > 
> > > "DISPLAY\_NAME": {  
> > > "type": "string",  
> > > "analyzer": "standard"  
> > > },
> > > 
> > > "index.analysis.analyzer.standard.type": "standard",  
> > > "index.analysis.analyzer.standard.stopwords": "_none_"
> > > 
> > > Any clue on this ? 🙂 Thanks
> > > 
> > > On Wed, Apr 30, 2014 at 12:37 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > > 
> > > > The end parameter is too low. It needs to be at a minimum the number of  
> > > > clauses in the span\_near query.
> > > > 
> > > > --  
> > > > Ivan
> > > > 
> > > > On Mon, Apr 28, 2014 at 7:05 PM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > 
> > > > > Hi Ivan,
> > > > > 
> > > > > Not able to get any result with the following query :
> > > > > 
> > > > > {  
> > > > > "from" : 100,  
> > > > > "size" : 100,  
> > > > > "query" : {  
> > > > > "span\_first" : {  
> > > > > "match" : {  
> > > > > "span\_near" : {  
> > > > > "clauses" : [  
> > > > > { "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
> > > > > { "span\_term" : { "DISPLAY\_NAME" : "people" } }
> > > > > 
> > > > > ```
> > > > > ],
> > > > > "slop" : 1,
> > > > > "in_order" : true
> > > > > }
> > > > > },
> > > > > "end" : 1
> > > > > }
> > > > > 
> > > > > ```
> > > > > 
> > > > > }  
> > > > > }
> > > > > 
> > > > > Meanwhile tried with :
> > > > > 
> > > > > {  
> > > > > "from" : 100,  
> > > > > "size" : 100,  
> > > > > "query" : {  
> > > > > "span\_first" : {  
> > > > > "match" : {  
> > > > > "span\_term" : { "DISPLAY\_NAME" : "happy" }  
> > > > > },  
> > > > > "end" : 1  
> > > > > }  
> > > > > }  
> > > > > }
> > > > > 
> > > > > and it returns :
> > > > > 
> > > > > ```
> > > > > "_index": "jdbc_dev",
> > > > > "_type": "media",
> > > > > "_id": "9556",
> > > > > "_score": 4.612431,
> > > > > "_source": {
> > > > > "DISPLAY_NAME": "Happy People",
> > > > > 
> > > > > ```
> > > > > 
> > > > > Anything wrong with my first query ?
> > > > > 
> > > > > Thanks
> > > > > 
> > > > > On Tue, Apr 29, 2014 at 12:16 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > > > > 
> > > > > > The main limitation of the span queries is that they only operate on  
> > > > > > analyzed terms. The terms used in span\_term must match the terms in the  
> > > > > > index. In your case, there is no single term "happy holiday" in your index,  
> > > > > > because the original document was tokenized into "happy" "birthday"  
> > > > > > "to" "you".
> > > > > > 
> > > > > > You would need to do a span near query of the two terms with a slop  
> > > > > > of 1 and in order. This span near query will then be the argument to the  
> > > > > > span first.
> > > > > > 
> > > > > > Here is a good explanation of span queries in Lucene:  
> > > > > > [http://searchhub.org/2009/07/18/the-spanquery/](http://searchhub.org/2009/07/18/the-spanquery/)
> > > > > > 
> > > > > > --  
> > > > > > Ivan
> > > > > > 
> > > > > > On Sun, Apr 27, 2014 at 11:24 PM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > > > 
> > > > > > > Hi Ivan,
> > > > > > > 
> > > > > > > I recreate the mapping and re-index the documents and now working  
> > > > > > > fine. Thanks.
> > > > > > > 
> > > > > > > Btw would like to ask how i could search two or more words in the  
> > > > > > > span\_first query as i need it to support the following searches :  
> > > > > > > 1)happy  
> > > > > > > 2)happy holiday  
> > > > > > > 3)happy birthday to you
> > > > > > > 
> > > > > > > {  
> > > > > > > "from" : 100,  
> > > > > > > "size" : 100,  
> > > > > > > "query" : {  
> > > > > > > "span\_first" : {  
> > > > > > > "match" : {  
> > > > > > > \* "span\_term" : { "DISPLAY\_NAME" : "happy holiday" }\*  
> > > > > > > },  
> > > > > > > "end" : 1  
> > > > > > > }  
> > > > > > > }  
> > > > > > > }
> > > > > > > 
> > > > > > > returns empty list even we have documents that display\_name start  
> > > > > > > with _happy holiday_.
> > > > > > > 
> > > > > > > Thanks.
> > > > > > > 
> > > > > > > On Sunday, April 27, 2014 2:55:37 AM UTC+8, cyrilforce wrote:
> > > > > > > 
> > > > > > > > Hi Ivan,
> > > > > > > > 
> > > > > > > > I am using version elasticsearch-0.90.1. Nope we don't have any  
> > > > > > > > templates. Not sure whether your are referring to the full index mapping  
> > > > > > > > here's the gist
> > > > > > > > 
> > > > > > > > media mapping  
> > > > > > > > [span\_first\_issue\_media\_mapping.json · GitHub](https://gist.github.com/cheehoo/11327970)
> > > > > > > > 
> > > > > > > > full index mapping  
> > > > > > > > [span\_first\_issue\_full\_index\_mappping.json · GitHub](https://gist.github.com/cheehoo/11327996)
> > > > > > > > 
> > > > > > > > Thanks in advance.
> > > > > > > > 
> > > > > > > > On Sat, Apr 26, 2014 at 8:31 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com)wrote:
> > > > > > > > 
> > > > > > > > > Your mapping looks correct. Which version are you running? Do you  
> > > > > > > > > have any templates?
> > > > > > > > > 
> > > > > > > > > Just to be on the safe side, can you provide the mapping that  
> > > > > > > > > Elasticsearch is using (not the one you provide):
> > > > > > > > > 
> > > > > > > > > [http://localhost:9200/jdbc\_dev/media/\_mapping](http://localhost:9200/jdbc_dev/media/_mapping)
> > > > > > > > > 
> > > > > > > > > --  
> > > > > > > > > Ivan
> > > > > > > > > 
> > > > > > > > > On Fri, Apr 25, 2014 at 3:24 AM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > > > > > > 
> > > > > > > > > > Hi,
> > > > > > > > > > 
> > > > > > > > > > I am trying to query some records via the span\_first query as  
> > > > > > > > > > below :
> > > > > > > > > > 
> > > > > > > > > > {  
> > > > > > > > > > "from" : 100,  
> > > > > > > > > > "size" : 100,  
> > > > > > > > > > "query" : {  
> > > > > > > > > > "span\_first" : {  
> > > > > > > > > > "match" : {  
> > > > > > > > > > \* "span\_term" : { "DISPLAY\_NAME" : "happy" }\*  
> > > > > > > > > > },  
> > > > > > > > > > "end" : 1  
> > > > > > > > > > }  
> > > > > > > > > > }  
> > > > > > > > > > }
> > > > > > > > > > 
> > > > > > > > > > however it returned me with an error :
> > > > > > > > > > 
> > > > > > > > > > ```
> > > > > > > > > > "index": "jdbc_dev",
> > > > > > > > > > "shard": 4,
> > > > > > > > > > "status": 500,
> > > > > > > > > > * "reason":
> > > > > > > > > > 
> > > > > > > > > > ```
> > > > > > > > > > 
> > > > > > > > > > "RemoteTransportException[[portal-web-02][inet[/192.168.96.27:9300]][search/phase/query/id]];  
> > > > > > > > > > nested: QueryPhaseExecutionException[[jdbc\_dev][4]:  
> > > > > > > > > > query[filtered(spanFirst(DISPLAY\_NAME:happy,  
> > > > > > > > > > 1))-\>cache(\_type:media)],from[100],size[100]: Query Failed [Failed to  
> > > > > > > > > > execute main query]]; nested: IllegalStateException[field "DISPLAY\_NAME"  
> > > > > > > > > > was indexed without position data; cannot run SpanTermQuery (term=happy)];  
> > > > > > > > > > "\*  
> > > > > > > > > > }
> > > > > > > > > > 
> > > > > > > > > > The mapping for that type :
> > > > > > > > > > 
> > > > > > > > > > {  
> > > > > > > > > > "media": {  
> > > > > > > > > > "properties": {  
> > > > > > > > > > "AUDIO": {  
> > > > > > > > > > "type": "string"  
> > > > > > > > > > },  
> > > > > > > > > > "BILLINGTYPE\_ID": {  
> > > > > > > > > > "type": "long"  
> > > > > > > > > > },  
> > > > > > > > > > "CATMEDIA\_CDATE": {  
> > > > > > > > > > "type": "date",  
> > > > > > > > > > "format": "dateOptionalTime"  
> > > > > > > > > > },  
> > > > > > > > > > "CATMEDIA\_NAME": {  
> > > > > > > > > > "type": "string"  
> > > > > > > > > > },  
> > > > > > > > > > "CATMEDIA\_RANK": {  
> > > > > > > > > > "type": "long"  
> > > > > > > > > > },  
> > > > > > > > > > "CAT\_ID": {  
> > > > > > > > > > "type": "long"  
> > > > > > > > > > },  
> > > > > > > > > > "CAT\_NAME": {  
> > > > > > > > > > "type": "string",  
> > > > > > > > > > "analyzer": "string\_lowercase",  
> > > > > > > > > > "include\_in\_all": true  
> > > > > > > > > > },  
> > > > > > > > > > "CAT\_PARENT": {  
> > > > > > > > > > "type": "long"  
> > > > > > > > > > },  
> > > > > > > > > > "CHANNEL\_ID": {  
> > > > > > > > > > "type": "long"  
> > > > > > > > > > },  
> > > > > > > > > > "CKEY": {  
> > > > > > > > > > "type": "long"  
> > > > > > > > > > },  
> > > > > > > > > > \* "DISPLAY\_NAME": {\*
> > > > > > > > > > 
> > > > > > > > > > - 
> > > > > > > > > > 
> > > > > > > > > > ```
> > > > > > > > > > "type": "string",*
> > > > > > > > > > 
> > > > > > > > > > ```
> > > > > > > > > > 
> > > > > > > > > > - 
> > > > > > > > > > 
> > > > > > > > > > ```
> > > > > > > > > > "analyzer": "standard"*
> > > > > > > > > > 
> > > > > > > > > > ```
> > > > > > > > > > 
> > > > > > > > > > - 
> > > > > > > > > > 
> > > > > > > > > > ```
> > > > > > > > > > },*
> > > > > > > > > > "FTID": {
> > > > > > > > > > "type": "string"
> > > > > > > > > > },
> > > > > > > > > > "GENRE": {
> > > > > > > > > > "type": "string"
> > > > > > > > > > },
> > > > > > > > > > "ITEMCODE": {
> > > > > > > > > > "type": "string"
> > > > > > > > > > },
> > > > > > > > > > "KEYWORDS": {
> > > > > > > > > > "type": "string"
> > > > > > > > > > },
> > > > > > > > > > "LANG_ID": {
> > > > > > > > > > "type": "long"
> > > > > > > > > > },
> > > > > > > > > > "LONG_DESCRIPTION": {
> > > > > > > > > > "type": "string"
> > > > > > > > > > },
> > > > > > > > > > "MAPPINGS": {
> > > > > > > > > > "type": "string",
> > > > > > > > > > "analyzer": "string_lowercase",
> > > > > > > > > > "include_in_all": true
> > > > > > > > > > },
> > > > > > > > > > "MEDIA_ID": {
> > > > > > > > > > "type": "long"
> > > > > > > > > > },
> > > > > > > > > > "MEDIA_PKEY": {
> > > > > > > > > > "type": "string"
> > > > > > > > > > },
> > > > > > > > > > "PERFORMER": {
> > > > > > > > > > "type": "string"
> > > > > > > > > > },
> > > > > > > > > > "PLAYER": {
> > > > > > > > > > "type": "string"
> > > > > > > > > > },
> > > > > > > > > > "POSITION": {
> > > > > > > > > > "type": "long"
> > > > > > > > > > },
> > > > > > > > > > "PRICE": {
> > > > > > > > > > "type": "double"
> > > > > > > > > > },
> > > > > > > > > > "PRIORITY": {
> > > > > > > > > > "type": "long"
> > > > > > > > > > },
> > > > > > > > > > "SHORTCODE": {
> > > > > > > > > > "type": "string"
> > > > > > > > > > },
> > > > > > > > > > "SHORT_DESCRIPTION": {
> > > > > > > > > > "type": "string"
> > > > > > > > > > },
> > > > > > > > > > "TYPE_ID": {
> > > > > > > > > > "type": "long"
> > > > > > > > > > },
> > > > > > > > > > "VIEW_ID": {
> > > > > > > > > > "type": "long"
> > > > > > > > > > }
> > > > > > > > > > }
> > > > > > > > > > 
> > > > > > > > > > ```
> > > > > > > > > > 
> > > > > > > > > > }  
> > > > > > > > > > }
> > > > > > > > > > 
> > > > > > > > > > I would like to know what is the reason and how i could fix it.  
> > > > > > > > > > Thanks.
> > > > > > > > > > 
> > > > > > > > > > --  
> > > > > > > > > > You received this message because you are subscribed to the  
> > > > > > > > > > Google Groups "elasticsearch" group.  
> > > > > > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > > > > > send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > > > > > > > > > 
> > > > > > > > > > To view this discussion on the web visit  
> > > > > > > > > > [https://groups.google.com/d/msgid/elasticsearch/ad8740af-](https://groups.google.com/d/msgid/elasticsearch/ad8740af-)  
> > > > > > > > > > 2038-40d4-9fc2-79d6e1402e5a%[40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > > > > > .  
> > > > > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > > > > 
> > > > > > > > > --  
> > > > > > > > > You received this message because you are subscribed to a topic in  
> > > > > > > > > the Google Groups "elasticsearch" group.  
> > > > > > > > > To unsubscribe from this topic, visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > > > > > topic/elasticsearch/cwzQrR1Rpsw/unsubscribe.  
> > > > > > > > > To unsubscribe from this group and all its topics, send an email  
> > > > > > > > > to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > > > > To view this discussion on the web visit  
> > > > > > > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%](https://groups.google.com/d/msgid/elasticsearch/CALY%25)  
> > > > > > > > > 3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%  
> > > > > > > > > [40mail.gmail.com](http://40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > > > > > .
> > > > > > > > > 
> > > > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > > > 
> > > > > > > > --  
> > > > > > > > Regards,
> > > > > > > > 
> > > > > > > > Chee Hoo
> > > > > > > 
> > > > > > > --  
> > > > > > > You received this message because you are subscribed to the Google  
> > > > > > > Groups "elasticsearch" group.  
> > > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > > send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > > To view this discussion on the web visit  
> > > > > > > [https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > > .
> > > > > > > 
> > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to a topic in  
> > > > > > the Google Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this topic, visit  
> > > > > > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe)  
> > > > > > .  
> > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > To view this discussion on the web visit  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > > .
> > > > > > 
> > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > 
> > > > > --  
> > > > > Regards,
> > > > > 
> > > > > Chee Hoo
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to the Google  
> > > > > Groups "elasticsearch" group.  
> > > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY\_eHFO\_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY_eHFO_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY\_eHFO\_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY_eHFO_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > .
> > > > > 
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit  
> > > > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, send an email to  
> > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG\_L\_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG_L_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG\_L\_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG_L_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > Regards,
> > > 
> > > Chee Hoo
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC\_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC\_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Regards,
> 
> Chee Hoo
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg\_vm-nbt%3D%2BcysQ7WJc0LXan\_hoF%3D%2BBLt%3DzC6H-dRVpYDQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg_vm-nbt%3D%2BcysQ7WJc0LXan_hoF%3D%2BBLt%3DzC6H-dRVpYDQ%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg\_vm-nbt%3D%2BcysQ7WJc0LXan\_hoF%3D%2BBLt%3DzC6H-dRVpYDQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg_vm-nbt%3D%2BcysQ7WJc0LXan_hoF%3D%2BBLt%3DzC6H-dRVpYDQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAn5pTivuh4p5Qt-dUt0wtBMNWrBy80X81f\_0Cu0hRAsQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAn5pTivuh4p5Qt-dUt0wtBMNWrBy80X81f_0Cu0hRAsQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![cyrilforce](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cyrilforce](https://discuss.elastic.co/u/cyrilforce)\
**Post date:** [April 30, 2014, 7:24am UTC](https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194/12 "2014-04-30T07:24:02Z")

</div>

Hi Ivan,

The gist for the curl recreation :

> <https://gist.github.com/cheehoo/b1b0e2d9e8dd4e05f59d>

Thanks.

On Wed, Apr 30, 2014 at 2:42 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> You should provide a full curl recreation with your exact documents and  
> mappings: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)
> 
> I have no issues executing a similar query. Note that the terms in  
> span\_term are not analyzed, but that should not matter for those words  
> using the standard analyzer.
> 
> --  
> Ivan
> 
> On Tue, Apr 29, 2014 at 10:59 PM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> 
> > Hi Ivan,
> > 
> > Running the following query it returns records below :
> > 
> > {  
> > "query" : { "match" : {"DISPLAY\_NAME" : "Happy People"} }  
> > }
> > 
> > Result :  
> > [query\_match\_result.txt · GitHub](https://gist.github.com/cheehoo/073ab926baa123b18224)
> > 
> > but running with span query suggested:
> > 
> > {  
> > "from" : 100,  
> > "size" : 100,  
> > "query" : {  
> > "span\_first" : {  
> > "match" : {  
> > "span\_near" : {  
> > "clauses" : [  
> > { "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
> > { "span\_term" : { "DISPLAY\_NAME" : "people" } }
> > 
> > ```
> > ],
> > "slop" : 1,
> > "in_order" : true
> > }
> > },
> > *"end" : 2*
> > }
> > 
> > ```
> > 
> > }  
> > }
> > 
> > no result returned.
> > 
> > Any clues 🙂
> > 
> > Thanks.
> > 
> > On Wed, Apr 30, 2014 at 12:04 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > 
> > > Do you have any documents that starts with "happy people"?
> > > 
> > > --  
> > > Ivan
> > > 
> > > On Tue, Apr 29, 2014 at 7:21 PM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > 
> > > > Hi Ivan,
> > > > 
> > > > Tried with 2 and 3 with no luck.
> > > > 
> > > > {  
> > > > "from" : 100,  
> > > > "size" : 100,  
> > > > "query" : {  
> > > > "span\_first" : {  
> > > > "match" : {  
> > > > "span\_near" : {  
> > > > "clauses" : [  
> > > > { "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
> > > > { "span\_term" : { "DISPLAY\_NAME" : "people" } }
> > > > 
> > > > ```
> > > > ],
> > > > "slop" : 1,
> > > > "in_order" : true
> > > > }
> > > > },
> > > > *"end" : 2*
> > > > }
> > > > 
> > > > ```
> > > > 
> > > > }  
> > > > }
> > > > 
> > > > The field is using "standard" analyzer with stopword=\_none:
> > > > 
> > > > "DISPLAY\_NAME": {  
> > > > "type": "string",  
> > > > "analyzer": "standard"  
> > > > },
> > > > 
> > > > "index.analysis.analyzer.standard.type": "standard",  
> > > > "index.analysis.analyzer.standard.stopwords": "_none_"
> > > > 
> > > > Any clue on this ? 🙂 Thanks
> > > > 
> > > > On Wed, Apr 30, 2014 at 12:37 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > > > 
> > > > > The end parameter is too low. It needs to be at a minimum the number  
> > > > > of clauses in the span\_near query.
> > > > > 
> > > > > --  
> > > > > Ivan
> > > > > 
> > > > > On Mon, Apr 28, 2014 at 7:05 PM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > > 
> > > > > > Hi Ivan,
> > > > > > 
> > > > > > Not able to get any result with the following query :
> > > > > > 
> > > > > > {  
> > > > > > "from" : 100,  
> > > > > > "size" : 100,  
> > > > > > "query" : {  
> > > > > > "span\_first" : {  
> > > > > > "match" : {  
> > > > > > "span\_near" : {  
> > > > > > "clauses" : [  
> > > > > > { "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
> > > > > > { "span\_term" : { "DISPLAY\_NAME" : "people" } }
> > > > > > 
> > > > > > ```
> > > > > > ],
> > > > > > "slop" : 1,
> > > > > > "in_order" : true
> > > > > > }
> > > > > > },
> > > > > > "end" : 1
> > > > > > }
> > > > > > 
> > > > > > ```
> > > > > > 
> > > > > > }  
> > > > > > }
> > > > > > 
> > > > > > Meanwhile tried with :
> > > > > > 
> > > > > > {  
> > > > > > "from" : 100,  
> > > > > > "size" : 100,  
> > > > > > "query" : {  
> > > > > > "span\_first" : {  
> > > > > > "match" : {  
> > > > > > "span\_term" : { "DISPLAY\_NAME" : "happy" }  
> > > > > > },  
> > > > > > "end" : 1  
> > > > > > }  
> > > > > > }  
> > > > > > }
> > > > > > 
> > > > > > and it returns :
> > > > > > 
> > > > > > ```
> > > > > > "_index": "jdbc_dev",
> > > > > > "_type": "media",
> > > > > > "_id": "9556",
> > > > > > "_score": 4.612431,
> > > > > > "_source": {
> > > > > > "DISPLAY_NAME": "Happy People",
> > > > > > 
> > > > > > ```
> > > > > > 
> > > > > > Anything wrong with my first query ?
> > > > > > 
> > > > > > Thanks
> > > > > > 
> > > > > > On Tue, Apr 29, 2014 at 12:16 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com)wrote:
> > > > > > 
> > > > > > > The main limitation of the span queries is that they only operate on  
> > > > > > > analyzed terms. The terms used in span\_term must match the terms in the  
> > > > > > > index. In your case, there is no single term "happy holiday" in your index,  
> > > > > > > because the original document was tokenized into "happy" "birthday"  
> > > > > > > "to" "you".
> > > > > > > 
> > > > > > > You would need to do a span near query of the two terms with a slop  
> > > > > > > of 1 and in order. This span near query will then be the argument to the  
> > > > > > > span first.
> > > > > > > 
> > > > > > > Here is a good explanation of span queries in Lucene:  
> > > > > > > [http://searchhub.org/2009/07/18/the-spanquery/](http://searchhub.org/2009/07/18/the-spanquery/)
> > > > > > > 
> > > > > > > --  
> > > > > > > Ivan
> > > > > > > 
> > > > > > > On Sun, Apr 27, 2014 at 11:24 PM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > > > > 
> > > > > > > > Hi Ivan,
> > > > > > > > 
> > > > > > > > I recreate the mapping and re-index the documents and now working  
> > > > > > > > fine. Thanks.
> > > > > > > > 
> > > > > > > > Btw would like to ask how i could search two or more words in the  
> > > > > > > > span\_first query as i need it to support the following searches :  
> > > > > > > > 1)happy  
> > > > > > > > 2)happy holiday  
> > > > > > > > 3)happy birthday to you
> > > > > > > > 
> > > > > > > > {  
> > > > > > > > "from" : 100,  
> > > > > > > > "size" : 100,  
> > > > > > > > "query" : {  
> > > > > > > > "span\_first" : {  
> > > > > > > > "match" : {  
> > > > > > > > \* "span\_term" : { "DISPLAY\_NAME" : "happy holiday" }\*  
> > > > > > > > },  
> > > > > > > > "end" : 1  
> > > > > > > > }  
> > > > > > > > }  
> > > > > > > > }
> > > > > > > > 
> > > > > > > > returns empty list even we have documents that display\_name start  
> > > > > > > > with _happy holiday_.
> > > > > > > > 
> > > > > > > > Thanks.
> > > > > > > > 
> > > > > > > > On Sunday, April 27, 2014 2:55:37 AM UTC+8, cyrilforce wrote:
> > > > > > > > 
> > > > > > > > > Hi Ivan,
> > > > > > > > > 
> > > > > > > > > I am using version elasticsearch-0.90.1. Nope we don't have any  
> > > > > > > > > templates. Not sure whether your are referring to the full index mapping  
> > > > > > > > > here's the gist
> > > > > > > > > 
> > > > > > > > > media mapping  
> > > > > > > > > [span\_first\_issue\_media\_mapping.json · GitHub](https://gist.github.com/cheehoo/11327970)
> > > > > > > > > 
> > > > > > > > > full index mapping  
> > > > > > > > > [span\_first\_issue\_full\_index\_mappping.json · GitHub](https://gist.github.com/cheehoo/11327996)
> > > > > > > > > 
> > > > > > > > > Thanks in advance.
> > > > > > > > > 
> > > > > > > > > On Sat, Apr 26, 2014 at 8:31 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com)wrote:
> > > > > > > > > 
> > > > > > > > > > Your mapping looks correct. Which version are you running? Do you  
> > > > > > > > > > have any templates?
> > > > > > > > > > 
> > > > > > > > > > Just to be on the safe side, can you provide the mapping that  
> > > > > > > > > > Elasticsearch is using (not the one you provide):
> > > > > > > > > > 
> > > > > > > > > > [http://localhost:9200/jdbc\_dev/media/\_mapping](http://localhost:9200/jdbc_dev/media/_mapping)
> > > > > > > > > > 
> > > > > > > > > > --  
> > > > > > > > > > Ivan
> > > > > > > > > > 
> > > > > > > > > > On Fri, Apr 25, 2014 at 3:24 AM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > > > > > > > 
> > > > > > > > > > > Hi,
> > > > > > > > > > > 
> > > > > > > > > > > I am trying to query some records via the span\_first query as  
> > > > > > > > > > > below :
> > > > > > > > > > > 
> > > > > > > > > > > {  
> > > > > > > > > > > "from" : 100,  
> > > > > > > > > > > "size" : 100,  
> > > > > > > > > > > "query" : {  
> > > > > > > > > > > "span\_first" : {  
> > > > > > > > > > > "match" : {  
> > > > > > > > > > > \* "span\_term" : { "DISPLAY\_NAME" : "happy" }\*  
> > > > > > > > > > > },  
> > > > > > > > > > > "end" : 1  
> > > > > > > > > > > }  
> > > > > > > > > > > }  
> > > > > > > > > > > }
> > > > > > > > > > > 
> > > > > > > > > > > however it returned me with an error :
> > > > > > > > > > > 
> > > > > > > > > > > ```
> > > > > > > > > > > "index": "jdbc_dev",
> > > > > > > > > > > "shard": 4,
> > > > > > > > > > > "status": 500,
> > > > > > > > > > > * "reason":
> > > > > > > > > > > 
> > > > > > > > > > > ```
> > > > > > > > > > > 
> > > > > > > > > > > "RemoteTransportException[[portal-web-02][inet[/192.168.96.27:9300]][search/phase/query/id]];  
> > > > > > > > > > > nested: QueryPhaseExecutionException[[jdbc\_dev][4]:  
> > > > > > > > > > > query[filtered(spanFirst(DISPLAY\_NAME:happy,  
> > > > > > > > > > > 1))-\>cache(\_type:media)],from[100],size[100]: Query Failed [Failed to  
> > > > > > > > > > > execute main query]]; nested: IllegalStateException[field "DISPLAY\_NAME"  
> > > > > > > > > > > was indexed without position data; cannot run SpanTermQuery (term=happy)];  
> > > > > > > > > > > "\*  
> > > > > > > > > > > }
> > > > > > > > > > > 
> > > > > > > > > > > The mapping for that type :
> > > > > > > > > > > 
> > > > > > > > > > > {  
> > > > > > > > > > > "media": {  
> > > > > > > > > > > "properties": {  
> > > > > > > > > > > "AUDIO": {  
> > > > > > > > > > > "type": "string"  
> > > > > > > > > > > },  
> > > > > > > > > > > "BILLINGTYPE\_ID": {  
> > > > > > > > > > > "type": "long"  
> > > > > > > > > > > },  
> > > > > > > > > > > "CATMEDIA\_CDATE": {  
> > > > > > > > > > > "type": "date",  
> > > > > > > > > > > "format": "dateOptionalTime"  
> > > > > > > > > > > },  
> > > > > > > > > > > "CATMEDIA\_NAME": {  
> > > > > > > > > > > "type": "string"  
> > > > > > > > > > > },  
> > > > > > > > > > > "CATMEDIA\_RANK": {  
> > > > > > > > > > > "type": "long"  
> > > > > > > > > > > },  
> > > > > > > > > > > "CAT\_ID": {  
> > > > > > > > > > > "type": "long"  
> > > > > > > > > > > },  
> > > > > > > > > > > "CAT\_NAME": {  
> > > > > > > > > > > "type": "string",  
> > > > > > > > > > > "analyzer": "string\_lowercase",  
> > > > > > > > > > > "include\_in\_all": true  
> > > > > > > > > > > },  
> > > > > > > > > > > "CAT\_PARENT": {  
> > > > > > > > > > > "type": "long"  
> > > > > > > > > > > },  
> > > > > > > > > > > "CHANNEL\_ID": {  
> > > > > > > > > > > "type": "long"  
> > > > > > > > > > > },  
> > > > > > > > > > > "CKEY": {  
> > > > > > > > > > > "type": "long"  
> > > > > > > > > > > },  
> > > > > > > > > > > \* "DISPLAY\_NAME": {\*
> > > > > > > > > > > 
> > > > > > > > > > > - 
> > > > > > > > > > > 
> > > > > > > > > > > ```
> > > > > > > > > > > "type": "string",*
> > > > > > > > > > > 
> > > > > > > > > > > ```
> > > > > > > > > > > 
> > > > > > > > > > > - 
> > > > > > > > > > > 
> > > > > > > > > > > ```
> > > > > > > > > > > "analyzer": "standard"*
> > > > > > > > > > > 
> > > > > > > > > > > ```
> > > > > > > > > > > 
> > > > > > > > > > > - 
> > > > > > > > > > > 
> > > > > > > > > > > ```
> > > > > > > > > > > },*
> > > > > > > > > > > "FTID": {
> > > > > > > > > > > "type": "string"
> > > > > > > > > > > },
> > > > > > > > > > > "GENRE": {
> > > > > > > > > > > "type": "string"
> > > > > > > > > > > },
> > > > > > > > > > > "ITEMCODE": {
> > > > > > > > > > > "type": "string"
> > > > > > > > > > > },
> > > > > > > > > > > "KEYWORDS": {
> > > > > > > > > > > "type": "string"
> > > > > > > > > > > },
> > > > > > > > > > > "LANG_ID": {
> > > > > > > > > > > "type": "long"
> > > > > > > > > > > },
> > > > > > > > > > > "LONG_DESCRIPTION": {
> > > > > > > > > > > "type": "string"
> > > > > > > > > > > },
> > > > > > > > > > > "MAPPINGS": {
> > > > > > > > > > > "type": "string",
> > > > > > > > > > > "analyzer": "string_lowercase",
> > > > > > > > > > > "include_in_all": true
> > > > > > > > > > > },
> > > > > > > > > > > "MEDIA_ID": {
> > > > > > > > > > > "type": "long"
> > > > > > > > > > > },
> > > > > > > > > > > "MEDIA_PKEY": {
> > > > > > > > > > > "type": "string"
> > > > > > > > > > > },
> > > > > > > > > > > "PERFORMER": {
> > > > > > > > > > > "type": "string"
> > > > > > > > > > > },
> > > > > > > > > > > "PLAYER": {
> > > > > > > > > > > "type": "string"
> > > > > > > > > > > },
> > > > > > > > > > > "POSITION": {
> > > > > > > > > > > "type": "long"
> > > > > > > > > > > },
> > > > > > > > > > > "PRICE": {
> > > > > > > > > > > "type": "double"
> > > > > > > > > > > },
> > > > > > > > > > > "PRIORITY": {
> > > > > > > > > > > "type": "long"
> > > > > > > > > > > },
> > > > > > > > > > > "SHORTCODE": {
> > > > > > > > > > > "type": "string"
> > > > > > > > > > > },
> > > > > > > > > > > "SHORT_DESCRIPTION": {
> > > > > > > > > > > "type": "string"
> > > > > > > > > > > },
> > > > > > > > > > > "TYPE_ID": {
> > > > > > > > > > > "type": "long"
> > > > > > > > > > > },
> > > > > > > > > > > "VIEW_ID": {
> > > > > > > > > > > "type": "long"
> > > > > > > > > > > }
> > > > > > > > > > > }
> > > > > > > > > > > 
> > > > > > > > > > > ```
> > > > > > > > > > > 
> > > > > > > > > > > }  
> > > > > > > > > > > }
> > > > > > > > > > > 
> > > > > > > > > > > I would like to know what is the reason and how i could fix it.  
> > > > > > > > > > > Thanks.
> > > > > > > > > > > 
> > > > > > > > > > > --  
> > > > > > > > > > > You received this message because you are subscribed to the  
> > > > > > > > > > > Google Groups "elasticsearch" group.  
> > > > > > > > > > > To unsubscribe from this group and stop receiving emails from  
> > > > > > > > > > > it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > > > > > > > > > > 
> > > > > > > > > > > To view this discussion on the web visit  
> > > > > > > > > > > [https://groups.google.com/d/msgid/elasticsearch/ad8740af-](https://groups.google.com/d/msgid/elasticsearch/ad8740af-)  
> > > > > > > > > > > 2038-40d4-9fc2-79d6e1402e5a%[40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > > > > > > .  
> > > > > > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > > > > > 
> > > > > > > > > > --  
> > > > > > > > > > You received this message because you are subscribed to a topic  
> > > > > > > > > > in the Google Groups "elasticsearch" group.  
> > > > > > > > > > To unsubscribe from this topic, visit  
> > > > > > > > > > [https://groups.google.com/d/topic/elasticsearch/](https://groups.google.com/d/topic/elasticsearch/)  
> > > > > > > > > > cwzQrR1Rpsw/unsubscribe.  
> > > > > > > > > > To unsubscribe from this group and all its topics, send an email  
> > > > > > > > > > to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > > > > > To view this discussion on the web visit  
> > > > > > > > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%](https://groups.google.com/d/msgid/elasticsearch/CALY%25)  
> > > > > > > > > > 3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%  
> > > > > > > > > > [40mail.gmail.com](http://40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > > > > > > .
> > > > > > > > > > 
> > > > > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > > > > 
> > > > > > > > > --  
> > > > > > > > > Regards,
> > > > > > > > > 
> > > > > > > > > Chee Hoo
> > > > > > > > 
> > > > > > > > --  
> > > > > > > > You received this message because you are subscribed to the Google  
> > > > > > > > Groups "elasticsearch" group.  
> > > > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > > > send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > > > To view this discussion on the web visit  
> > > > > > > > [https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > > > .
> > > > > > > > 
> > > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > > 
> > > > > > > --  
> > > > > > > You received this message because you are subscribed to a topic in  
> > > > > > > the Google Groups "elasticsearch" group.  
> > > > > > > To unsubscribe from this topic, visit  
> > > > > > > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe)  
> > > > > > > .  
> > > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > > To view this discussion on the web visit  
> > > > > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > > > .
> > > > > > > 
> > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > 
> > > > > > --  
> > > > > > Regards,
> > > > > > 
> > > > > > Chee Hoo
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to the Google  
> > > > > > Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > To view this discussion on the web visit  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY\_eHFO\_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY_eHFO_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY\_eHFO\_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY_eHFO_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > > .
> > > > > > 
> > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to a topic in the  
> > > > > Google Groups "elasticsearch" group.  
> > > > > To unsubscribe from this topic, visit  
> > > > > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe)  
> > > > > .  
> > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG\_L\_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG_L_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG\_L\_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG_L_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > .
> > > > > 
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > Regards,
> > > > 
> > > > Chee Hoo
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC\_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC\_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > Regards,
> > 
> > Chee Hoo
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg\_vm-nbt%3D%2BcysQ7WJc0LXan\_hoF%3D%2BBLt%3DzC6H-dRVpYDQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg_vm-nbt%3D%2BcysQ7WJc0LXan_hoF%3D%2BBLt%3DzC6H-dRVpYDQ%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg\_vm-nbt%3D%2BcysQ7WJc0LXan\_hoF%3D%2BBLt%3DzC6H-dRVpYDQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg_vm-nbt%3D%2BcysQ7WJc0LXan_hoF%3D%2BBLt%3DzC6H-dRVpYDQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAn5pTivuh4p5Qt-dUt0wtBMNWrBy80X81f\_0Cu0hRAsQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAn5pTivuh4p5Qt-dUt0wtBMNWrBy80X81f_0Cu0hRAsQ%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAn5pTivuh4p5Qt-dUt0wtBMNWrBy80X81f\_0Cu0hRAsQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAn5pTivuh4p5Qt-dUt0wtBMNWrBy80X81f_0Cu0hRAsQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Regards,

Chee Hoo

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg\_-kS3nn82h-rxZxVDMJREpZM5G8O0ygkc6\_Onzm-98Ag%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg_-kS3nn82h-rxZxVDMJREpZM5G8O0ygkc6_Onzm-98Ag%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [April 30, 2014, 2:00pm UTC](https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194/13 "2014-04-30T14:00:13Z")

</div>

You are using a keyword tokenizer, so your fields are not being tokenized  
at all. If you are always interested in just the start of the field, you  
can perhaps use a prefix query:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

--  
Ivan

On Wed, Apr 30, 2014 at 12:24 AM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com) wrote:

> Hi Ivan,
> 
> The gist for the curl recreation :  
> [span\_term\_curl\_recreation.json · GitHub](https://gist.github.com/cheehoo/b1b0e2d9e8dd4e05f59d)
> 
> Thanks.
> 
> On Wed, Apr 30, 2014 at 2:42 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> 
> > You should provide a full curl recreation with your exact documents and  
> > mappings: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)
> > 
> > I have no issues executing a similar query. Note that the terms in  
> > span\_term are not analyzed, but that should not matter for those words  
> > using the standard analyzer.
> > 
> > --  
> > Ivan
> > 
> > On Tue, Apr 29, 2014 at 10:59 PM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > 
> > > Hi Ivan,
> > > 
> > > Running the following query it returns records below :
> > > 
> > > {  
> > > "query" : { "match" : {"DISPLAY\_NAME" : "Happy People"} }  
> > > }
> > > 
> > > Result :  
> > > [query\_match\_result.txt · GitHub](https://gist.github.com/cheehoo/073ab926baa123b18224)
> > > 
> > > but running with span query suggested:
> > > 
> > > {  
> > > "from" : 100,  
> > > "size" : 100,  
> > > "query" : {  
> > > "span\_first" : {  
> > > "match" : {  
> > > "span\_near" : {  
> > > "clauses" : [  
> > > { "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
> > > { "span\_term" : { "DISPLAY\_NAME" : "people" } }
> > > 
> > > ```
> > > ],
> > > "slop" : 1,
> > > "in_order" : true
> > > }
> > > },
> > > *"end" : 2*
> > > }
> > > 
> > > ```
> > > 
> > > }  
> > > }
> > > 
> > > no result returned.
> > > 
> > > Any clues 🙂
> > > 
> > > Thanks.
> > > 
> > > On Wed, Apr 30, 2014 at 12:04 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > > 
> > > > Do you have any documents that starts with "happy people"?
> > > > 
> > > > --  
> > > > Ivan
> > > > 
> > > > On Tue, Apr 29, 2014 at 7:21 PM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > 
> > > > > Hi Ivan,
> > > > > 
> > > > > Tried with 2 and 3 with no luck.
> > > > > 
> > > > > {  
> > > > > "from" : 100,  
> > > > > "size" : 100,  
> > > > > "query" : {  
> > > > > "span\_first" : {  
> > > > > "match" : {  
> > > > > "span\_near" : {  
> > > > > "clauses" : [  
> > > > > { "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
> > > > > { "span\_term" : { "DISPLAY\_NAME" : "people" } }
> > > > > 
> > > > > ```
> > > > > ],
> > > > > "slop" : 1,
> > > > > "in_order" : true
> > > > > }
> > > > > },
> > > > > *"end" : 2*
> > > > > }
> > > > > 
> > > > > ```
> > > > > 
> > > > > }  
> > > > > }
> > > > > 
> > > > > The field is using "standard" analyzer with stopword=\_none:
> > > > > 
> > > > > "DISPLAY\_NAME": {  
> > > > > "type": "string",  
> > > > > "analyzer": "standard"  
> > > > > },
> > > > > 
> > > > > "index.analysis.analyzer.standard.type": "standard",  
> > > > > "index.analysis.analyzer.standard.stopwords": "_none_"
> > > > > 
> > > > > Any clue on this ? 🙂 Thanks
> > > > > 
> > > > > On Wed, Apr 30, 2014 at 12:37 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > > > > 
> > > > > > The end parameter is too low. It needs to be at a minimum the number  
> > > > > > of clauses in the span\_near query.
> > > > > > 
> > > > > > --  
> > > > > > Ivan
> > > > > > 
> > > > > > On Mon, Apr 28, 2014 at 7:05 PM, chee hoo lum [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > > > 
> > > > > > > Hi Ivan,
> > > > > > > 
> > > > > > > Not able to get any result with the following query :
> > > > > > > 
> > > > > > > {  
> > > > > > > "from" : 100,  
> > > > > > > "size" : 100,  
> > > > > > > "query" : {  
> > > > > > > "span\_first" : {  
> > > > > > > "match" : {  
> > > > > > > "span\_near" : {  
> > > > > > > "clauses" : [  
> > > > > > > { "span\_term" : { "DISPLAY\_NAME" : "happy" } },  
> > > > > > > { "span\_term" : { "DISPLAY\_NAME" : "people" } }
> > > > > > > 
> > > > > > > ```
> > > > > > > ],
> > > > > > > "slop" : 1,
> > > > > > > "in_order" : true
> > > > > > > }
> > > > > > > },
> > > > > > > "end" : 1
> > > > > > > }
> > > > > > > 
> > > > > > > ```
> > > > > > > 
> > > > > > > }  
> > > > > > > }
> > > > > > > 
> > > > > > > Meanwhile tried with :
> > > > > > > 
> > > > > > > {  
> > > > > > > "from" : 100,  
> > > > > > > "size" : 100,  
> > > > > > > "query" : {  
> > > > > > > "span\_first" : {  
> > > > > > > "match" : {  
> > > > > > > "span\_term" : { "DISPLAY\_NAME" : "happy" }  
> > > > > > > },  
> > > > > > > "end" : 1  
> > > > > > > }  
> > > > > > > }  
> > > > > > > }
> > > > > > > 
> > > > > > > and it returns :
> > > > > > > 
> > > > > > > ```
> > > > > > > "_index": "jdbc_dev",
> > > > > > > "_type": "media",
> > > > > > > "_id": "9556",
> > > > > > > "_score": 4.612431,
> > > > > > > "_source": {
> > > > > > > "DISPLAY_NAME": "Happy People",
> > > > > > > 
> > > > > > > ```
> > > > > > > 
> > > > > > > Anything wrong with my first query ?
> > > > > > > 
> > > > > > > Thanks
> > > > > > > 
> > > > > > > On Tue, Apr 29, 2014 at 12:16 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com)wrote:
> > > > > > > 
> > > > > > > > The main limitation of the span queries is that they only operate  
> > > > > > > > on analyzed terms. The terms used in span\_term must match the terms in the  
> > > > > > > > index. In your case, there is no single term "happy holiday" in your index,  
> > > > > > > > because the original document was tokenized into "happy"  
> > > > > > > > "birthday" "to" "you".
> > > > > > > > 
> > > > > > > > You would need to do a span near query of the two terms with a slop  
> > > > > > > > of 1 and in order. This span near query will then be the argument to the  
> > > > > > > > span first.
> > > > > > > > 
> > > > > > > > Here is a good explanation of span queries in Lucene:  
> > > > > > > > [http://searchhub.org/2009/07/18/the-spanquery/](http://searchhub.org/2009/07/18/the-spanquery/)
> > > > > > > > 
> > > > > > > > --  
> > > > > > > > Ivan
> > > > > > > > 
> > > > > > > > On Sun, Apr 27, 2014 at 11:24 PM, cyrilforce [cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)wrote:
> > > > > > > > 
> > > > > > > > > Hi Ivan,
> > > > > > > > > 
> > > > > > > > > I recreate the mapping and re-index the documents and now working  
> > > > > > > > > fine. Thanks.
> > > > > > > > > 
> > > > > > > > > Btw would like to ask how i could search two or more words in the  
> > > > > > > > > span\_first query as i need it to support the following searches :  
> > > > > > > > > 1)happy  
> > > > > > > > > 2)happy holiday  
> > > > > > > > > 3)happy birthday to you
> > > > > > > > > 
> > > > > > > > > {  
> > > > > > > > > "from" : 100,  
> > > > > > > > > "size" : 100,  
> > > > > > > > > "query" : {  
> > > > > > > > > "span\_first" : {  
> > > > > > > > > "match" : {  
> > > > > > > > > \* "span\_term" : { "DISPLAY\_NAME" : "happy holiday" }\*  
> > > > > > > > > },  
> > > > > > > > > "end" : 1  
> > > > > > > > > }  
> > > > > > > > > }  
> > > > > > > > > }
> > > > > > > > > 
> > > > > > > > > returns empty list even we have documents that display\_name start  
> > > > > > > > > with _happy holiday_.
> > > > > > > > > 
> > > > > > > > > Thanks.
> > > > > > > > > 
> > > > > > > > > On Sunday, April 27, 2014 2:55:37 AM UTC+8, cyrilforce wrote:
> > > > > > > > > 
> > > > > > > > > > Hi Ivan,
> > > > > > > > > > 
> > > > > > > > > > I am using version elasticsearch-0.90.1. Nope we don't have any  
> > > > > > > > > > templates. Not sure whether your are referring to the full index mapping  
> > > > > > > > > > here's the gist
> > > > > > > > > > 
> > > > > > > > > > media mapping  
> > > > > > > > > > [span\_first\_issue\_media\_mapping.json · GitHub](https://gist.github.com/cheehoo/11327970)
> > > > > > > > > > 
> > > > > > > > > > full index mapping  
> > > > > > > > > > [span\_first\_issue\_full\_index\_mappping.json · GitHub](https://gist.github.com/cheehoo/11327996)
> > > > > > > > > > 
> > > > > > > > > > Thanks in advance.
> > > > > > > > > > 
> > > > > > > > > > On Sat, Apr 26, 2014 at 8:31 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com)wrote:
> > > > > > > > > > 
> > > > > > > > > > > Your mapping looks correct. Which version are you running? Do  
> > > > > > > > > > > you have any templates?
> > > > > > > > > > > 
> > > > > > > > > > > Just to be on the safe side, can you provide the mapping that  
> > > > > > > > > > > Elasticsearch is using (not the one you provide):
> > > > > > > > > > > 
> > > > > > > > > > > [http://localhost:9200/jdbc\_dev/media/\_mapping](http://localhost:9200/jdbc_dev/media/_mapping)
> > > > > > > > > > > 
> > > > > > > > > > > --  
> > > > > > > > > > > Ivan
> > > > > > > > > > > 
> > > > > > > > > > > On Fri, Apr 25, 2014 at 3:24 AM, cyrilforce \<[cheehoo84@gmail.com](mailto:cheehoo84@gmail.com)
> > > > > > > > > > > 
> > > > > > > > > > > > wrote:
> > > > > > > > > > > 
> > > > > > > > > > > > Hi,
> > > > > > > > > > > > 
> > > > > > > > > > > > I am trying to query some records via the span\_first query as  
> > > > > > > > > > > > below :
> > > > > > > > > > > > 
> > > > > > > > > > > > {  
> > > > > > > > > > > > "from" : 100,  
> > > > > > > > > > > > "size" : 100,  
> > > > > > > > > > > > "query" : {  
> > > > > > > > > > > > "span\_first" : {  
> > > > > > > > > > > > "match" : {  
> > > > > > > > > > > > \* "span\_term" : { "DISPLAY\_NAME" : "happy" }\*  
> > > > > > > > > > > > },  
> > > > > > > > > > > > "end" : 1  
> > > > > > > > > > > > }  
> > > > > > > > > > > > }  
> > > > > > > > > > > > }
> > > > > > > > > > > > 
> > > > > > > > > > > > however it returned me with an error :
> > > > > > > > > > > > 
> > > > > > > > > > > > ```
> > > > > > > > > > > > "index": "jdbc_dev",
> > > > > > > > > > > > "shard": 4,
> > > > > > > > > > > > "status": 500,
> > > > > > > > > > > > * "reason":
> > > > > > > > > > > > 
> > > > > > > > > > > > ```
> > > > > > > > > > > > 
> > > > > > > > > > > > "RemoteTransportException[[portal-web-02][inet[/192.168.96.27:9300]][search/phase/query/id]];  
> > > > > > > > > > > > nested: QueryPhaseExecutionException[[jdbc\_dev][4]:  
> > > > > > > > > > > > query[filtered(spanFirst(DISPLAY\_NAME:happy,  
> > > > > > > > > > > > 1))-\>cache(\_type:media)],from[100],size[100]: Query Failed [Failed to  
> > > > > > > > > > > > execute main query]]; nested: IllegalStateException[field "DISPLAY\_NAME"  
> > > > > > > > > > > > was indexed without position data; cannot run SpanTermQuery (term=happy)];  
> > > > > > > > > > > > "\*  
> > > > > > > > > > > > }
> > > > > > > > > > > > 
> > > > > > > > > > > > The mapping for that type :
> > > > > > > > > > > > 
> > > > > > > > > > > > {  
> > > > > > > > > > > > "media": {  
> > > > > > > > > > > > "properties": {  
> > > > > > > > > > > > "AUDIO": {  
> > > > > > > > > > > > "type": "string"  
> > > > > > > > > > > > },  
> > > > > > > > > > > > "BILLINGTYPE\_ID": {  
> > > > > > > > > > > > "type": "long"  
> > > > > > > > > > > > },  
> > > > > > > > > > > > "CATMEDIA\_CDATE": {  
> > > > > > > > > > > > "type": "date",  
> > > > > > > > > > > > "format": "dateOptionalTime"  
> > > > > > > > > > > > },  
> > > > > > > > > > > > "CATMEDIA\_NAME": {  
> > > > > > > > > > > > "type": "string"  
> > > > > > > > > > > > },  
> > > > > > > > > > > > "CATMEDIA\_RANK": {  
> > > > > > > > > > > > "type": "long"  
> > > > > > > > > > > > },  
> > > > > > > > > > > > "CAT\_ID": {  
> > > > > > > > > > > > "type": "long"  
> > > > > > > > > > > > },  
> > > > > > > > > > > > "CAT\_NAME": {  
> > > > > > > > > > > > "type": "string",  
> > > > > > > > > > > > "analyzer": "string\_lowercase",  
> > > > > > > > > > > > "include\_in\_all": true  
> > > > > > > > > > > > },  
> > > > > > > > > > > > "CAT\_PARENT": {  
> > > > > > > > > > > > "type": "long"  
> > > > > > > > > > > > },  
> > > > > > > > > > > > "CHANNEL\_ID": {  
> > > > > > > > > > > > "type": "long"  
> > > > > > > > > > > > },  
> > > > > > > > > > > > "CKEY": {  
> > > > > > > > > > > > "type": "long"  
> > > > > > > > > > > > },  
> > > > > > > > > > > > \* "DISPLAY\_NAME": {\*
> > > > > > > > > > > > 
> > > > > > > > > > > > - 
> > > > > > > > > > > > 
> > > > > > > > > > > > ```
> > > > > > > > > > > > "type": "string",*
> > > > > > > > > > > > 
> > > > > > > > > > > > ```
> > > > > > > > > > > > 
> > > > > > > > > > > > - 
> > > > > > > > > > > > 
> > > > > > > > > > > > ```
> > > > > > > > > > > > "analyzer": "standard"*
> > > > > > > > > > > > 
> > > > > > > > > > > > ```
> > > > > > > > > > > > 
> > > > > > > > > > > > - 
> > > > > > > > > > > > 
> > > > > > > > > > > > ```
> > > > > > > > > > > > },*
> > > > > > > > > > > > "FTID": {
> > > > > > > > > > > > "type": "string"
> > > > > > > > > > > > },
> > > > > > > > > > > > "GENRE": {
> > > > > > > > > > > > "type": "string"
> > > > > > > > > > > > },
> > > > > > > > > > > > "ITEMCODE": {
> > > > > > > > > > > > "type": "string"
> > > > > > > > > > > > },
> > > > > > > > > > > > "KEYWORDS": {
> > > > > > > > > > > > "type": "string"
> > > > > > > > > > > > },
> > > > > > > > > > > > "LANG_ID": {
> > > > > > > > > > > > "type": "long"
> > > > > > > > > > > > },
> > > > > > > > > > > > "LONG_DESCRIPTION": {
> > > > > > > > > > > > "type": "string"
> > > > > > > > > > > > },
> > > > > > > > > > > > "MAPPINGS": {
> > > > > > > > > > > > "type": "string",
> > > > > > > > > > > > "analyzer": "string_lowercase",
> > > > > > > > > > > > "include_in_all": true
> > > > > > > > > > > > },
> > > > > > > > > > > > "MEDIA_ID": {
> > > > > > > > > > > > "type": "long"
> > > > > > > > > > > > },
> > > > > > > > > > > > "MEDIA_PKEY": {
> > > > > > > > > > > > "type": "string"
> > > > > > > > > > > > },
> > > > > > > > > > > > "PERFORMER": {
> > > > > > > > > > > > "type": "string"
> > > > > > > > > > > > },
> > > > > > > > > > > > "PLAYER": {
> > > > > > > > > > > > "type": "string"
> > > > > > > > > > > > },
> > > > > > > > > > > > "POSITION": {
> > > > > > > > > > > > "type": "long"
> > > > > > > > > > > > },
> > > > > > > > > > > > "PRICE": {
> > > > > > > > > > > > "type": "double"
> > > > > > > > > > > > },
> > > > > > > > > > > > "PRIORITY": {
> > > > > > > > > > > > "type": "long"
> > > > > > > > > > > > },
> > > > > > > > > > > > "SHORTCODE": {
> > > > > > > > > > > > "type": "string"
> > > > > > > > > > > > },
> > > > > > > > > > > > "SHORT_DESCRIPTION": {
> > > > > > > > > > > > "type": "string"
> > > > > > > > > > > > },
> > > > > > > > > > > > "TYPE_ID": {
> > > > > > > > > > > > "type": "long"
> > > > > > > > > > > > },
> > > > > > > > > > > > "VIEW_ID": {
> > > > > > > > > > > > "type": "long"
> > > > > > > > > > > > }
> > > > > > > > > > > > }
> > > > > > > > > > > > 
> > > > > > > > > > > > ```
> > > > > > > > > > > > 
> > > > > > > > > > > > }  
> > > > > > > > > > > > }
> > > > > > > > > > > > 
> > > > > > > > > > > > I would like to know what is the reason and how i could fix it.  
> > > > > > > > > > > > Thanks.
> > > > > > > > > > > > 
> > > > > > > > > > > > --  
> > > > > > > > > > > > You received this message because you are subscribed to the  
> > > > > > > > > > > > Google Groups "elasticsearch" group.  
> > > > > > > > > > > > To unsubscribe from this group and stop receiving emails from  
> > > > > > > > > > > > it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)  
> > > > > > > > > > > > .
> > > > > > > > > > > > 
> > > > > > > > > > > > To view this discussion on the web visit  
> > > > > > > > > > > > [https://groups.google.com/d/msgid/elasticsearch/ad8740af-](https://groups.google.com/d/msgid/elasticsearch/ad8740af-)  
> > > > > > > > > > > > 2038-40d4-9fc2-79d6e1402e5a%[40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ad8740af-2038-40d4-9fc2-79d6e1402e5a%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > > > > > > > .  
> > > > > > > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > > > > > > 
> > > > > > > > > > > --  
> > > > > > > > > > > You received this message because you are subscribed to a topic  
> > > > > > > > > > > in the Google Groups "elasticsearch" group.  
> > > > > > > > > > > To unsubscribe from this topic, visit  
> > > > > > > > > > > [https://groups.google.com/d/topic/elasticsearch/](https://groups.google.com/d/topic/elasticsearch/)  
> > > > > > > > > > > cwzQrR1Rpsw/unsubscribe.  
> > > > > > > > > > > To unsubscribe from this group and all its topics, send an email  
> > > > > > > > > > > to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > > > > > > To view this discussion on the web visit  
> > > > > > > > > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%](https://groups.google.com/d/msgid/elasticsearch/CALY%25)  
> > > > > > > > > > > 3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%  
> > > > > > > > > > > [40mail.gmail.com](http://40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBYhpWDHm-h-1rXFO%3DvHY0y4qkHdcHrR57nGEc0f1haAw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > > > > > > > .
> > > > > > > > > > > 
> > > > > > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > > > > > 
> > > > > > > > > > --  
> > > > > > > > > > Regards,
> > > > > > > > > > 
> > > > > > > > > > Chee Hoo
> > > > > > > > > 
> > > > > > > > > --  
> > > > > > > > > You received this message because you are subscribed to the Google  
> > > > > > > > > Groups "elasticsearch" group.  
> > > > > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > > > > send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > > > > To view this discussion on the web visit  
> > > > > > > > > [https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/c6d86b5e-52c9-479d-b2fa-78ef9f8bde0d%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > > > > > .
> > > > > > > > > 
> > > > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > > > 
> > > > > > > > --  
> > > > > > > > You received this message because you are subscribed to a topic in  
> > > > > > > > the Google Groups "elasticsearch" group.  
> > > > > > > > To unsubscribe from this topic, visit  
> > > > > > > > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe)  
> > > > > > > > .  
> > > > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > > > To view this discussion on the web visit  
> > > > > > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd\_\_MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBefd__MOrWNUzHvTdkk8ZtMD1BxHAB26Cxz3k3OSYSAQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > > > > .
> > > > > > > > 
> > > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > > 
> > > > > > > --  
> > > > > > > Regards,
> > > > > > > 
> > > > > > > Chee Hoo
> > > > > > > 
> > > > > > > --  
> > > > > > > You received this message because you are subscribed to the Google  
> > > > > > > Groups "elasticsearch" group.  
> > > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > > send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > > To view this discussion on the web visit  
> > > > > > > [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY\_eHFO\_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY_eHFO_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY\_eHFO\_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg9iuY_eHFO_VUywCQYB18FOWprT%3D9ZBDm4id8A0brq0Pw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > > > .
> > > > > > > 
> > > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to a topic in  
> > > > > > the Google Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this topic, visit  
> > > > > > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe)  
> > > > > > .  
> > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > > To view this discussion on the web visit  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG\_L\_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG_L_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG\_L\_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBrN1ft3kG_L_LZ39KF-L1Y7hBsPFy%3D2ar64%3DqKe3ogLw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > > .
> > > > > > 
> > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > 
> > > > > --  
> > > > > Regards,
> > > > > 
> > > > > Chee Hoo
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to the Google  
> > > > > Groups "elasticsearch" group.  
> > > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > > To view this discussion on the web visit  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC\_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC\_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg8vUBhgDgnyhC_DT4PtwmGn4%3D6%2BCHpg9UrgnZNhgTEKig%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > > .
> > > > > 
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit  
> > > > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, send an email to  
> > > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > To view this discussion on the web visit  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDubi%2Bf9W50UtMc4GJ2XpuoGSB7se0b7o31Zs6GKfLFZg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > Regards,
> > > 
> > > Chee Hoo
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg\_vm-nbt%3D%2BcysQ7WJc0LXan\_hoF%3D%2BBLt%3DzC6H-dRVpYDQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg_vm-nbt%3D%2BcysQ7WJc0LXan_hoF%3D%2BBLt%3DzC6H-dRVpYDQ%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg\_vm-nbt%3D%2BcysQ7WJc0LXan\_hoF%3D%2BBLt%3DzC6H-dRVpYDQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg_vm-nbt%3D%2BcysQ7WJc0LXan_hoF%3D%2BBLt%3DzC6H-dRVpYDQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/cwzQrR1Rpsw/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAn5pTivuh4p5Qt-dUt0wtBMNWrBy80X81f\_0Cu0hRAsQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAn5pTivuh4p5Qt-dUt0wtBMNWrBy80X81f_0Cu0hRAsQ%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAn5pTivuh4p5Qt-dUt0wtBMNWrBy80X81f\_0Cu0hRAsQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAn5pTivuh4p5Qt-dUt0wtBMNWrBy80X81f_0Cu0hRAsQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Regards,
> 
> Chee Hoo
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg\_-kS3nn82h-rxZxVDMJREpZM5G8O0ygkc6\_Onzm-98Ag%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg_-kS3nn82h-rxZxVDMJREpZM5G8O0ygkc6_Onzm-98Ag%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg\_-kS3nn82h-rxZxVDMJREpZM5G8O0ygkc6\_Onzm-98Ag%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGS0%2Bg_-kS3nn82h-rxZxVDMJREpZM5G8O0ygkc6_Onzm-98Ag%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBn5ChmvF9grYpLNvZJ1\_moW2VdHGL2imR3FCi2szn0%3DA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBn5ChmvF9grYpLNvZJ1_moW2VdHGL2imR3FCi2szn0%3DA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:32am UTC](https://discuss.elastic.co/t/illegalstateexception-field-display-name-was-indexed-without-position-data/17194/14 "2017-07-06T01:32:28Z")

</div>


