# Field "region" was indexed without position data; cannot run PhraseQuery

**URL:** <https://discuss.elastic.co/t/field-region-was-indexed-without-position-data-cannot-run-phrasequery/18808>\
**Category:** Elasticsearch\
**Created:** [July 23, 2014, 3:46am UTC](https://discuss.elastic.co/t/field-region-was-indexed-without-position-data-cannot-run-phrasequery/18808 "2014-07-23T03:46:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xu\_piao](https://avatars.discourse-cdn.com/v4/letter/x/f14d63/32.png) [@xu\_piao](https://discuss.elastic.co/u/xu_piao)\
**Post date:** [July 23, 2014, 3:46am UTC](https://discuss.elastic.co/t/field-region-was-indexed-without-position-data-cannot-run-phrasequery/18808/1 "2014-07-23T03:46:49Z")

</div>

i have an exception when i use 'query\_string' to search with 'multi\_field'  
.

my docs is indexed by json  
,like:{"region":"北京北京市海淀区","name":"群下子群|成员测试-82282","intra":"taipeng","geo":{"lon":116.3092,"lat":39.98364},"address":"泰鹏大厦"}

the field not all my docs have

my search request :  
{  
"bool" : {  
"must" : {  
"query\_string" : {  
"query" : "北京西路",  
"fields" : ["region"]  
}  
},  
"minimum\_should\_match" : "1"  
}  
}

my mappings :

matrix: {

- mappings: {
  - group: {
    - properties: {
    - region: {
      - type: string
      - store: true
      - analyzer: ik  
}

  - }
  - }

}

}

exception ：org.elasticsearch.action.search.SearchPhaseExecutionException:  
Failed to execute phase [query], all shards failed; shardFailures  
{[C\_c2mxBJS7KVuP2tcb1aIw][matrix][0]:  
RemoteTransportException[[Auric][inet[/10.0.8.102:19300]][search/phase/query]];  
nested: QueryPhaseExecutionException[[matrix][0]:  
query[filtered((region:"北京  
西路"))-\>cache(\_type:group)],from[0],size[20],sort[\<custom:"geo":  
org.elasticsearch.index.fielddata.fieldcomparator.GeoDistanceComparatorSource@6f26b9e7\>]:  
Query Failed [Failed to execute main query]]; nested:  
IllegalStateException[field "region" was indexed without position data;  
cannot run PhraseQuery (term=北京)]; }{[jwf1krq1QY27yqNt1\_2vVQ][matrix][4]:  
QueryPhaseExecutionException[[matrix][4]: query[filtered((region:"北京  
西路"))-\>cache(\_type:group)],from[0],size[20],sort[\<custom:"geo":  
org.elasticsearch.index.fielddata.fieldcomparator.GeoDistanceComparatorSource@43ececca\>]:  
Query Failed [Failed to execute main query]]; nested:  
IllegalStateException[field "region" was indexed without position data;  
cannot run PhraseQuery (term=北京)]; }{[jwf1krq1QY27yqNt1\_2vVQ][matrix][3]:  
QueryPhaseExecutionException[[matrix][3]: query[filtered((region:"北京  
西路"))-\>cache(\_type:group)],from[0],size[20],sort[\<custom:"geo":  
org.elasticsearch.index.fielddata.fieldcomparator.GeoDistanceComparatorSource@70e10093\>]:  
Query Failed [Failed to execute main query]]; nested:  
IllegalStateException[field "region" was indexed without position data;  
cannot run PhraseQuery (term=北京)]; }{[C\_c2mxBJS7KVuP2tcb1aIw][matrix][2]:  
RemoteTransportException[[Auric][inet[/10.0.8.102:19300]][search/phase/query]];  
nested: QueryPhaseExecutionException[[matrix][2]:  
query[filtered((region:"北京  
西路"))-\>cache(\_type:group)],from[0],size[20],sort[\<custom:"geo":  
org.elasticsearch.index.fielddata.fieldcomparator.GeoDistanceComparatorSource@577725b3\>]:  
Query Failed [Failed to execute main query]]; nested:  
IllegalStateException[field "region" was indexed without position data;  
cannot run PhraseQuery (term=北京)]; }{[jwf1krq1QY27yqNt1\_2vVQ][matrix][1]:  
QueryPhaseExecutionException[[matrix][1]: query[filtered((region:"北京  
西路"))-\>cache(\_type:group)],from[0],size[20],sort[\<custom:"geo":  
org.elasticsearch.index.fielddata.fieldcomparator.GeoDistanceComparatorSource@5fd068b\>]:  
Query Failed [Failed to execute main query]]; nested:  
IllegalStateException[field "region" was indexed without position data;  
cannot run PhraseQuery (term=北京)]; }  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:276)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$3.onFailure(TransportSearchTypeAction.java:224)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:205)  
at  
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:216)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$4.run(TransportSearchTypeAction.java:296)  
at  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)  
at java.lang.Thread.run(Thread.java:722)

- 

--  
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/1c21f47a-3a42-4ad1-90b6-94ffbd6b269a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1c21f47a-3a42-4ad1-90b6-94ffbd6b269a%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:** [July 23, 2014, 5:43am UTC](https://discuss.elastic.co/t/field-region-was-indexed-without-position-data-cannot-run-phrasequery/18808/2 "2014-07-23T05:43:57Z")

</div>

Your mapping does not seem correct. Can you post the output of the get  
mapping API instead? It appears that the region field might be a geo type  
instead. Analyzed fields should have position data enabled by default.

--  
Ivan

On Tue, Jul 22, 2014 at 8:46 PM, xu piao [xupiaobj@gmail.com](mailto:xupiaobj@gmail.com) wrote:

> i have an exception when i use 'query\_string' to search with 'multi\_field'  
> .
> 
> my docs is indexed by json  
> ,like:{"region":"北京北京市海淀区","name":"群下子群|成员测试-82282","intra":"taipeng","geo":{"lon":116.3092,"lat":39.98364},"address":"泰鹏大厦"}
> 
> the field not all my docs have
> 
> my search request :  
> {  
> "bool" : {  
> "must" : {  
> "query\_string" : {  
> "query" : "北京西路",  
> "fields" : ["region"]  
> }  
> },  
> "minimum\_should\_match" : "1"  
> }  
> }
> 
> my mappings :
> 
> matrix: {
> 
> - mappings: {
> - group: {
> - properties: {
> - region: {
> - type: string
> - store: true
> - analyzer: ik  
> }
> 
> - }
> - }
> 
> }
> 
> }
> 
> exception ：org.elasticsearch.action.search.SearchPhaseExecutionException:  
> Failed to execute phase [query], all shards failed; shardFailures  
> {[C\_c2mxBJS7KVuP2tcb1aIw][matrix][0]:  
> RemoteTransportException[[Auric][inet[/10.0.8.102:19300]][search/phase/query]];  
> nested: QueryPhaseExecutionException[[matrix][0]:  
> query[filtered((region:"北京  
> 西路"))-\>cache(\_type:group)],from[0],size[20],sort[\<custom:"geo":  
> org.elasticsearch.index.fielddata.fieldcomparator.GeoDistanceComparatorSource@6f26b9e7\>]:  
> Query Failed [Failed to execute main query]]; nested:  
> IllegalStateException[field "region" was indexed without position data;  
> cannot run PhraseQuery (term=北京)]; }{[jwf1krq1QY27yqNt1\_2vVQ][matrix][4]:  
> QueryPhaseExecutionException[[matrix][4]: query[filtered((region:"北京  
> 西路"))-\>cache(\_type:group)],from[0],size[20],sort[\<custom:"geo":  
> org.elasticsearch.index.fielddata.fieldcomparator.GeoDistanceComparatorSource@43ececca\>]:  
> Query Failed [Failed to execute main query]]; nested:  
> IllegalStateException[field "region" was indexed without position data;  
> cannot run PhraseQuery (term=北京)]; }{[jwf1krq1QY27yqNt1\_2vVQ][matrix][3]:  
> QueryPhaseExecutionException[[matrix][3]: query[filtered((region:"北京  
> 西路"))-\>cache(\_type:group)],from[0],size[20],sort[\<custom:"geo":  
> org.elasticsearch.index.fielddata.fieldcomparator.GeoDistanceComparatorSource@70e10093\>]:  
> Query Failed [Failed to execute main query]]; nested:  
> IllegalStateException[field "region" was indexed without position data;  
> cannot run PhraseQuery (term=北京)]; }{[C\_c2mxBJS7KVuP2tcb1aIw][matrix][2]:  
> RemoteTransportException[[Auric][inet[/10.0.8.102:19300]][search/phase/query]];  
> nested: QueryPhaseExecutionException[[matrix][2]:  
> query[filtered((region:"北京  
> 西路"))-\>cache(\_type:group)],from[0],size[20],sort[\<custom:"geo":  
> org.elasticsearch.index.fielddata.fieldcomparator.GeoDistanceComparatorSource@577725b3\>]:  
> Query Failed [Failed to execute main query]]; nested:  
> IllegalStateException[field "region" was indexed without position data;  
> cannot run PhraseQuery (term=北京)]; }{[jwf1krq1QY27yqNt1\_2vVQ][matrix][1]:  
> QueryPhaseExecutionException[[matrix][1]: query[filtered((region:"北京  
> 西路"))-\>cache(\_type:group)],from[0],size[20],sort[\<custom:"geo":  
> org.elasticsearch.index.fielddata.fieldcomparator.GeoDistanceComparatorSource@5fd068b\>]:  
> Query Failed [Failed to execute main query]]; nested:  
> IllegalStateException[field "region" was indexed without position data;  
> cannot run PhraseQuery (term=北京)]; }  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:276)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$3.onFailure(TransportSearchTypeAction.java:224)  
> at  
> org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:205)  
> at  
> org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:216)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$4.run(TransportSearchTypeAction.java:296)  
> at  
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)  
> at java.lang.Thread.run(Thread.java:722)
> 
> - 
> 
> --  
> 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/1c21f47a-3a42-4ad1-90b6-94ffbd6b269a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1c21f47a-3a42-4ad1-90b6-94ffbd6b269a%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/1c21f47a-3a42-4ad1-90b6-94ffbd6b269a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/1c21f47a-3a42-4ad1-90b6-94ffbd6b269a%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%3DcQCitLgNkOQX68WZYdND7DF-%2Bj46VvpcUnznyR0-WvAUxg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCitLgNkOQX68WZYdND7DF-%2Bj46VvpcUnznyR0-WvAUxg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![xu\_piao](https://avatars.discourse-cdn.com/v4/letter/x/f14d63/32.png) [@xu\_piao](https://discuss.elastic.co/u/xu_piao)\
**Post date:** [July 23, 2014, 5:57am UTC](https://discuss.elastic.co/t/field-region-was-indexed-without-position-data-cannot-run-phrasequery/18808/3 "2014-07-23T05:57:03Z")

</div>

this is my mapping :  
{

- "matrix":{
  - "mappings":{
    - "group":{
      - "properties":{
        - "address":{
          - "type":"string",
          - "store":true,
          - "analyzer":"ik"  
},

        - "geo":{
          - "type":"geo\_point",
          - "store":true  
},

        - "intra":{
          - "type":"string",
          - "store":true,
          - "analyzer":"ik"  
},

        - "name":{
          - "type":"string",
          - "store":true,
          - "analyzer":"ik"  
},

        - "region":{
          - "type":"string",
          - "store":true,
          - "analyzer":"ik"  
},

        - "tags":{
          - "type":"string",
          - "store":true,
          - "analyzer":"ik"  
}  
}  
}  
}  
}

}

在 2014年7月23日星期三UTC+8下午1时44分09秒，Ivan Brusic写道：

> Your mapping does not seem correct. Can you post the output of the get  
> mapping API instead? It appears that the region field might be a geo type  
> instead. Analyzed fields should have position data enabled by default.
> 
> --  
> Ivan
> 
> On Tue, Jul 22, 2014 at 8:46 PM, xu piao \<[xupi...@gmail.com](mailto:xupi...@gmail.com) \<javascript:\>\>  
> wrote:
> 
> > i have an exception when i use 'query\_string' to search with  
> > 'multi\_field' .
> > 
> > my docs is indexed by json  
> > ,like:{"region":"北京北京市海淀区","name":"群下子群|成员测试-82282","intra":"taipeng","geo":{"lon":116.3092,"lat":39.98364},"address":"泰鹏大厦"}
> > 
> > the field not all my docs have
> > 
> > my search request :  
> > {  
> > "bool" : {  
> > "must" : {  
> > "query\_string" : {  
> > "query" : "北京西路",  
> > "fields" : ["region"]  
> > }  
> > },  
> > "minimum\_should\_match" : "1"  
> > }  
> > }
> > 
> > my mappings :
> > 
> > matrix: {
> > 
> > - mappings: {
> > - group: {
> > - properties: {
> > - region: {
> > - type: string
> > - store: true
> > - analyzer: ik  
> > }
> > 
> > - }
> > - }
> > 
> > }
> > 
> > }
> > 
> > exception ：org.elasticsearch.action.search.SearchPhaseExecutionException:  
> > Failed to execute phase [query], all shards failed; shardFailures  
> > {[C\_c2mxBJS7KVuP2tcb1aIw][matrix][0]:  
> > RemoteTransportException[[Auric][inet[/10.0.8.102:19300]][search/phase/query]];  
> > nested: QueryPhaseExecutionException[[matrix][0]:  
> > query[filtered((region:"北京  
> > 西路"))-\>cache(\_type:group)],from[0],size[20],sort[\<custom:"geo":  
> > org.elasticsearch.index.fielddata.fieldcomparator.GeoDistanceComparatorSource@6f26b9e7\>]:  
> > Query Failed [Failed to execute main query]]; nested:  
> > IllegalStateException[field "region" was indexed without position data;  
> > cannot run PhraseQuery (term=北京)]; }{[jwf1krq1QY27yqNt1\_2vVQ][matrix][4]:  
> > QueryPhaseExecutionException[[matrix][4]: query[filtered((region:"北京  
> > 西路"))-\>cache(\_type:group)],from[0],size[20],sort[\<custom:"geo":  
> > org.elasticsearch.index.fielddata.fieldcomparator.GeoDistanceComparatorSource@43ececca\>]:  
> > Query Failed [Failed to execute main query]]; nested:  
> > IllegalStateException[field "region" was indexed without position data;  
> > cannot run PhraseQuery (term=北京)]; }{[jwf1krq1QY27yqNt1\_2vVQ][matrix][3]:  
> > QueryPhaseExecutionException[[matrix][3]: query[filtered((region:"北京  
> > 西路"))-\>cache(\_type:group)],from[0],size[20],sort[\<custom:"geo":  
> > org.elasticsearch.index.fielddata.fieldcomparator.GeoDistanceComparatorSource@70e10093\>]:  
> > Query Failed [Failed to execute main query]]; nested:  
> > IllegalStateException[field "region" was indexed without position data;  
> > cannot run PhraseQuery (term=北京)]; }{[C\_c2mxBJS7KVuP2tcb1aIw][matrix][2]:  
> > RemoteTransportException[[Auric][inet[/10.0.8.102:19300]][search/phase/query]];  
> > nested: QueryPhaseExecutionException[[matrix][2]:  
> > query[filtered((region:"北京  
> > 西路"))-\>cache(\_type:group)],from[0],size[20],sort[\<custom:"geo":  
> > org.elasticsearch.index.fielddata.fieldcomparator.GeoDistanceComparatorSource@577725b3\>]:  
> > Query Failed [Failed to execute main query]]; nested:  
> > IllegalStateException[field "region" was indexed without position data;  
> > cannot run PhraseQuery (term=北京)]; }{[jwf1krq1QY27yqNt1\_2vVQ][matrix][1]:  
> > QueryPhaseExecutionException[[matrix][1]: query[filtered((region:"北京  
> > 西路"))-\>cache(\_type:group)],from[0],size[20],sort[\<custom:"geo":  
> > org.elasticsearch.index.fielddata.fieldcomparator.GeoDistanceComparatorSource@5fd068b\>]:  
> > Query Failed [Failed to execute main query]]; nested:  
> > IllegalStateException[field "region" was indexed without position data;  
> > cannot run PhraseQuery (term=北京)]; }  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:276)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$3.onFailure(TransportSearchTypeAction.java:224)  
> > at  
> > org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:205)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:216)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$4.run(TransportSearchTypeAction.java:296)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)  
> > at java.lang.Thread.run(Thread.java:722)
> > 
> > - 
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/1c21f47a-3a42-4ad1-90b6-94ffbd6b269a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1c21f47a-3a42-4ad1-90b6-94ffbd6b269a%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/1c21f47a-3a42-4ad1-90b6-94ffbd6b269a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/1c21f47a-3a42-4ad1-90b6-94ffbd6b269a%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/8d083186-1d41-4d52-b22b-313944ee4bb9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8d083186-1d41-4d52-b22b-313944ee4bb9%40googlegroups.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:14am UTC](https://discuss.elastic.co/t/field-region-was-indexed-without-position-data-cannot-run-phrasequery/18808/4 "2017-07-06T01:14:05Z")

</div>


