# Exception when quering for exact match (but mapping works fine for few documents)

**URL:** <https://discuss.elastic.co/t/exception-when-quering-for-exact-match-but-mapping-works-fine-for-few-documents/13700>\
**Category:** Elasticsearch\
**Created:** [September 20, 2013, 9:27am UTC](https://discuss.elastic.co/t/exception-when-quering-for-exact-match-but-mapping-works-fine-for-few-documents/13700 "2013-09-20T09:27:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ales\_Kafka\_2](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Ales\_Kafka\_2](https://discuss.elastic.co/u/Ales_Kafka_2)\
**Post date:** [September 20, 2013, 9:27am UTC](https://discuss.elastic.co/t/exception-when-quering-for-exact-match-but-mapping-works-fine-for-few-documents/13700/1 "2013-09-20T09:27:38Z")

</div>

I'm trying to index football related data and query them. I want to query  
for exact match, because some fields contains lots of names and quering for  
string like 'Frank Lampard' won't be very accurate. So I want use  
query\_string and do exact match of '"Frank Lampard"' and there I run into  
troubles.

With just few documents in my type (like 50 maximum), everything runs  
smoothly. But when I index few more documents, Elasticsearch gives me  
following Exception:

query[filtered(+ConstantScore(_:_) +(goals:"frank

> lampard"))-\>cache(\_type:match)],from[0],size[10]: Query Failed [Failed to  
> execute main query]]; nested: IllegalStateException[field "goals" was  
> indexed without position data; cannot run PhraseQuery (term=frank)]; }]

My mapping in this case is very simple, just custom analyzer with truncate,  
webalize, lowercase and asciifolding. I tried almost every combination of  
index\_options and term\_vector, but nothing seems to work.

I run following version of Elasticsearch on my MacbookPro:  
{  
"ok" : true,  
"status" : 200,  
"name" : "Omega I",  
"version" : {  
"number" : "0.90.3",  
"build\_hash" : "5c38d6076448b899d758f29443329571e2522410",  
"build\_timestamp" : "2013-08-06T13:18:31Z",  
"build\_snapshot" : false,  
"lucene\_version" : "4.4"  
},  
"tagline" : "You Know, for Search"  
}

Any suggestions?  
Thanks,  
Ales Kafka

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [September 20, 2013, 4:07pm UTC](https://discuss.elastic.co/t/exception-when-quering-for-exact-match-but-mapping-works-fine-for-few-documents/13700/2 "2013-09-20T16:07:37Z")

</div>

Can you provide your mapping, especially for the goal field? Better yet,  
what does the mapping API return? At some point, it was indexed without  
positions.

--  
Ivan

On Fri, Sep 20, 2013 at 2:27 AM, Ales Kafka [ales.kafka@gmail.com](mailto:ales.kafka@gmail.com) wrote:

> I'm trying to index football related data and query them. I want to query  
> for exact match, because some fields contains lots of names and quering for  
> string like 'Frank Lampard' won't be very accurate. So I want use  
> query\_string and do exact match of '"Frank Lampard"' and there I run into  
> troubles.
> 
> With just few documents in my type (like 50 maximum), everything runs  
> smoothly. But when I index few more documents, Elasticsearch gives me  
> following Exception:
> 
> query[filtered(+ConstantScore(_:_) +(goals:"frank
> 
> > lampard"))-\>cache(\_type:match)],from[0],size[10]: Query Failed [Failed to  
> > execute main query]]; nested: IllegalStateException[field "goals" was  
> > indexed without position data; cannot run PhraseQuery (term=frank)]; }]
> 
> My mapping in this case is very simple, just custom analyzer with  
> truncate, webalize, lowercase and asciifolding. I tried almost every  
> combination of index\_options and term\_vector, but nothing seems to work.
> 
> I run following version of Elasticsearch on my MacbookPro:  
> {  
> "ok" : true,  
> "status" : 200,  
> "name" : "Omega I",  
> "version" : {  
> "number" : "0.90.3",  
> "build\_hash" : "5c38d6076448b899d758f29443329571e2522410",  
> "build\_timestamp" : "2013-08-06T13:18:31Z",  
> "build\_snapshot" : false,  
> "lucene\_version" : "4.4"  
> },  
> "tagline" : "You Know, for Search"  
> }
> 
> Any suggestions?  
> Thanks,  
> Ales Kafka
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ales\_Kafka\_2](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Ales\_Kafka\_2](https://discuss.elastic.co/u/Ales_Kafka_2)\
**Post date:** [September 20, 2013, 9:00pm UTC](https://discuss.elastic.co/t/exception-when-quering-for-exact-match-but-mapping-works-fine-for-few-documents/13700/3 "2013-09-20T21:00:10Z")

</div>

Thank you for taking interest in my problem.

I tried few more things and I think I have found the reason of this  
behaviour. The original mapping is just fine (few byte fields and another 7  
string fields with simple analyzer and index\_options set to positions).  
This works fine, even when I index thousands of documents. But I originally  
had other mappings in this index and some string fields had index\_options  
set as docs. After I index documents to these mappings, the aforementioned  
problem immediatelly occurrs.

I run into same behaviour in our production server, where older version of  
Elasticsearch is installed. For my case, setting index\_options to positions  
will help. But it's probably a nasty bug.

Dne pátek, 20. září 2013 18:07:37 UTC+2 Ivan Brusic napsal(a):

> Can you provide your mapping, especially for the goal field? Better yet,  
> what does the mapping API return? At some point, it was indexed without  
> positions.
> 
> --  
> Ivan
> 
> On Fri, Sep 20, 2013 at 2:27 AM, Ales Kafka \<[ales....@gmail.com](mailto:ales....@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > I'm trying to index football related data and query them. I want to query  
> > for exact match, because some fields contains lots of names and quering for  
> > string like 'Frank Lampard' won't be very accurate. So I want use  
> > query\_string and do exact match of '"Frank Lampard"' and there I run into  
> > troubles.
> > 
> > With just few documents in my type (like 50 maximum), everything runs  
> > smoothly. But when I index few more documents, Elasticsearch gives me  
> > following Exception:
> > 
> > query[filtered(+ConstantScore(_:_) +(goals:"frank
> > 
> > > lampard"))-\>cache(\_type:match)],from[0],size[10]: Query Failed [Failed to  
> > > execute main query]]; nested: IllegalStateException[field "goals" was  
> > > indexed without position data; cannot run PhraseQuery (term=frank)]; }]
> > 
> > My mapping in this case is very simple, just custom analyzer with  
> > truncate, webalize, lowercase and asciifolding. I tried almost every  
> > combination of index\_options and term\_vector, but nothing seems to work.
> > 
> > I run following version of Elasticsearch on my MacbookPro:  
> > {  
> > "ok" : true,  
> > "status" : 200,  
> > "name" : "Omega I",  
> > "version" : {  
> > "number" : "0.90.3",  
> > "build\_hash" : "5c38d6076448b899d758f29443329571e2522410",  
> > "build\_timestamp" : "2013-08-06T13:18:31Z",  
> > "build\_snapshot" : false,  
> > "lucene\_version" : "4.4"  
> > },  
> > "tagline" : "You Know, for Search"  
> > }
> > 
> > Any suggestions?  
> > Thanks,  
> > Ales Kafka
> > 
> > --  
> > 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:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:15am UTC](https://discuss.elastic.co/t/exception-when-quering-for-exact-match-but-mapping-works-fine-for-few-documents/13700/4 "2017-07-06T02:15:18Z")

</div>


