# Unable to Search and Terms Facet for a field value 'A' of the indexed document

**URL:** https://discuss.elastic.co/t/unable-to-search-and-terms-facet-for-a-field-value-a-of-the-indexed-document/12603
**Category:** Elasticsearch
**Created:** [July 1, 2013, 3:34pm UTC](https://discuss.elastic.co/t/unable-to-search-and-terms-facet-for-a-field-value-a-of-the-indexed-document/12603 "2013-07-01T15:34:06Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![kumarsuryamani](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@kumarsuryamani](https://discuss.elastic.co/u/kumarsuryamani)
#### Post date: [July 1, 2013, 3:34pm UTC](https://discuss.elastic.co/t/unable-to-search-and-terms-facet-for-a-field-value-a-of-the-indexed-document/12603/1 "2013-07-01T15:34:06Z")

</div>

Hi!

I have a document indexed which has field BayesianAnalysers and the field  
data is stored as following:

"BayesianAnalysers":[{"Safety":[{"text":"Undecided"}],"Power":[{"text":"Undecided"}],"Freedom":[{"text":"A"}],"Growth":[{"text":"B"}],"Subscribe":[{"text":"Undecided"}],"Desire":[{"text":"Undecided"}],"Intent":[{"text":"B"}],"Sentiment":[{"text":"Undecided"}]

When I run search query or Terms Facet for field values having value "A",  
example in the case above, BayesianAnalysers.Freedom.text="A"; it fails to  
search however for the field values "B" or "Undecided", it works fine. I  
used Java API as well and this results same ☹

Please suggest and let me know if need any additional input.

regards,  
surya

--  
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: [July 1, 2013, 4:12pm UTC](https://discuss.elastic.co/t/unable-to-search-and-terms-facet-for-a-field-value-a-of-the-indexed-document/12603/2 "2013-07-01T16:12:03Z")

</div>

If you are using the default Standard analyzer, then "a" is treated as a  
stop word and ignored. Another analyzer (perhaps custom) is better suited  
for your field.

--  
Ivan

On Mon, Jul 1, 2013 at 8:34 AM, Kumar Surya Mani [ksuryamani@gmail.com](mailto:ksuryamani@gmail.com)wrote:

> Hi!
> 
> I have a document indexed which has field BayesianAnalysers and the field  
> data is stored as following:
> 
> "BayesianAnalysers":[{"Safety":[{"text":"Undecided"}],"Power":[{"text":"Undecided"}],"Freedom":[{"text":"A"}],"Growth":[{"text":"B"}],"Subscribe":[{"text":"Undecided"}],"Desire":[{"text":"Undecided"}],"Intent":[{"text":"B"}],"Sentiment":[{"text":"Undecided"}]
> 
> When I run search query or Terms Facet for field values having value "A",  
> example in the case above, BayesianAnalysers.Freedom.text="A"; it fails to  
> search however for the field values "B" or "Undecided", it works fine. I  
> used Java API as well and this results same ☹
> 
> Please suggest and let me know if need any additional input.
> 
> regards,  
> surya
> 
> --  
> 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: ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)
#### Post date: [July 1, 2013, 6:23pm UTC](https://discuss.elastic.co/t/unable-to-search-and-terms-facet-for-a-field-value-a-of-the-indexed-document/12603/3 "2013-07-01T18:23:48Z")

</div>

You changed the analyzer used to analyze the terms in your query, but your  
index was still created with the Standard analyzer, therefore the terms do  
not exist in your index.

You need to change the analyzer used at index time. The trick to using  
Lucene (and therefore elasticsearch) is to ensure that you use the same  
analyzer during indexing and searching (not always the case, but in  
general).

BTW, you should always reply to the mailing list and not to anyone one  
person that replies. There are a ton of smart people on the mailing list  
and many of them are eager to help.

Cheers,

Ivan

On Mon, Jul 1, 2013 at 10:56 AM, Kumar Surya Mani [ksuryamani@gmail.com](mailto:ksuryamani@gmail.com)wrote:

> Ivan, thanks for your response.
> 
> Here I am trying to use 2 different analyzers, keyword and whitespace,  
> there is no change in the text analysis.
> 
> curl -X POST "  
> [http://localhost:9200/surya1/\_search?pretty=true&analyzer=keyword](http://localhost:9200/surya1/_search?pretty=true&analyzer=keyword)"  
> -d'{"query":{"multi\_match":{"query":"A B Undecided", "fields":  
> ["BayesianAnalysers.Intet.text","BayesianAnalysers.Subscribe.text"]}},"facets":{"format":{"terms":{"field":"BayesianAnalysers.Subscribe.text"}}}}'
> 
> "facets" : {  
> "format" : {  
> "\_type" : "terms",  
> "missing" : 69,  
> "total" : 125,  
> "other" : 0,  
> "terms" : [ {  
> "term" : "undecided",  
> "count" : 98  
> }, {  
> "term" : "b",  
> "count" : 27  
> } ]  
> }  
> }
> 
> curl -X POST "  
> [http://localhost:9200/surya1/\_search?pretty=true&analyzer=whitespace](http://localhost:9200/surya1/_search?pretty=true&analyzer=whitespace)"  
> -d'{"query":{"multi\_match":{"query":"A B Undecided", "fields":  
> ["BayesianAnalysers.Itent.text","BayesianAnalysers.Subscribe.text"]}},"facets":{"format":{"terms":{"field":"BayesianAnalysers.Subscribe.text"}}}}
> 
> "facets" : {  
> "format" : {  
> "\_type" : "terms",  
> "missing" : 69,  
> "total" : 125,  
> "other" : 0,  
> "terms" : [ {  
> "term" : "undecided",  
> "count" : 98  
> }, {  
> "term" : "b",  
> "count" : 27  
> } ]  
> }  
> }
> 
> Here again only "B" and "Undecided" values are considered.
> 
> --@surya
> 
> On Monday, July 1, 2013 9:42:03 PM UTC+5:30, Ivan Brusic wrote:
> 
> > If you are using the default Standard analyzer, then "a" is treated as a  
> > stop word and ignored. Another analyzer (perhaps custom) is better suited  
> > for your field.
> > 
> > --  
> > Ivan
> > 
> > On Mon, Jul 1, 2013 at 8:34 AM, Kumar Surya Mani [ksury...@gmail.com](mailto:ksury...@gmail.com)wrote:
> > 
> > > Hi!
> > > 
> > > I have a document indexed which has field BayesianAnalysers and the  
> > > field data is stored as following:
> > > 
> > > "BayesianAnalysers":[{"Safety"**:[{"text":"Undecided"}],"**  
> > > Power":[{"text":"Undecided"}],**"Freedom":[{"text":"A"}],"**  
> > > Growth":[{"text":"B"}],"**Subscribe":[{"text":"**  
> > > Undecided"}],"Desire":[{"text"**:"Undecided"}],"Intent":[{"**  
> > > text":"B"}],"Sentiment":[{"\*\*text":"Undecided"}]
> > > 
> > > When I run search query or Terms Facet for field values having value  
> > > "A", example in the case above, BayesianAnalysers.Freedom.\*\*text="A";  
> > > it fails to search however for the field values "B" or "Undecided", it  
> > > works fine. I used Java API as well and this results same ☹
> > > 
> > > Please suggest and let me know if need any additional input.
> > > 
> > > regards,  
> > > surya
> > > 
> > > --  
> > > 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](http://googlegroups.com).
> > > 
> > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[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: ![kumarsuryamani](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@kumarsuryamani](https://discuss.elastic.co/u/kumarsuryamani)
#### Post date: [July 1, 2013, 6:23pm UTC](https://discuss.elastic.co/t/unable-to-search-and-terms-facet-for-a-field-value-a-of-the-indexed-document/12603/4 "2013-07-01T18:23:49Z")

</div>

On Monday, July 1, 2013 9:04:06 PM UTC+5:30, Kumar Surya Mani wrote:

> Hi!
> 
> I have a document indexed which has field BayesianAnalysers and the field  
> data is stored as following:
> 
> "BayesianAnalysers":[{"Safety":[{"text":"Undecided"}],"Power":[{"text":"Undecided"}],"Freedom":[{"text":"A"}],"Growth":[{"text":"B"}],"Subscribe":[{"text":"Undecided"}],"Desire":[{"text":"Undecided"}],"Intent":[{"text":"B"}],"Sentiment":[{"text":"Undecided"}]
> 
> When I run search query or Terms Facet for field values having value "A",  
> example in the case above, BayesianAnalysers.Freedom.text="A"; it fails to  
> search however for the field values "B" or "Undecided", it works fine. I  
> used Java API as well and this results same ☹
> 
> Please suggest and let me know if need any additional input.
> 
> regards,  
> surya

--  
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: ![kumarsuryamani](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@kumarsuryamani](https://discuss.elastic.co/u/kumarsuryamani)
#### Post date: [July 1, 2013, 6:41pm UTC](https://discuss.elastic.co/t/unable-to-search-and-terms-facet-for-a-field-value-a-of-the-indexed-document/12603/5 "2013-07-01T18:41:03Z")

</div>

Thanks Ivan...I need to explore it further.

On Monday, July 1, 2013 11:53:48 PM UTC+5:30, Ivan Brusic wrote:

> You changed the analyzer used to analyze the terms in your query, but your  
> index was still created with the Standard analyzer, therefore the terms do  
> not exist in your index.
> 
> You need to change the analyzer used at index time. The trick to using  
> Lucene (and therefore elasticsearch) is to ensure that you use the same  
> analyzer during indexing and searching (not always the case, but in  
> general).
> 
> BTW, you should always reply to the mailing list and not to anyone one  
> person that replies. There are a ton of smart people on the mailing list  
> and many of them are eager to help.
> 
> Cheers,
> 
> Ivan
> 
> On Mon, Jul 1, 2013 at 10:56 AM, Kumar Surya Mani \<[ksury...@gmail.com](mailto:ksury...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Ivan, thanks for your response.
> > 
> > Here I am trying to use 2 different analyzers, keyword and whitespace,  
> > there is no change in the text analysis.
> > 
> > curl -X POST "  
> > [http://localhost:9200/surya1/\_search?pretty=true&analyzer=keyword](http://localhost:9200/surya1/_search?pretty=true&analyzer=keyword)"  
> > -d'{"query":{"multi\_match":{"query":"A B Undecided", "fields":  
> > ["BayesianAnalysers.Intet.text","BayesianAnalysers.Subscribe.text"]}},"facets":{"format":{"terms":{"field":"BayesianAnalysers.Subscribe.text"}}}}'
> > 
> > "facets" : {  
> > "format" : {  
> > "\_type" : "terms",  
> > "missing" : 69,  
> > "total" : 125,  
> > "other" : 0,  
> > "terms" : [ {  
> > "term" : "undecided",  
> > "count" : 98  
> > }, {  
> > "term" : "b",  
> > "count" : 27  
> > } ]  
> > }  
> > }
> > 
> > curl -X POST "  
> > [http://localhost:9200/surya1/\_search?pretty=true&analyzer=whitespace](http://localhost:9200/surya1/_search?pretty=true&analyzer=whitespace)"  
> > -d'{"query":{"multi\_match":{"query":"A B Undecided", "fields":  
> > ["BayesianAnalysers.Itent.text","BayesianAnalysers.Subscribe.text"]}},"facets":{"format":{"terms":{"field":"BayesianAnalysers.Subscribe.text"}}}}
> > 
> > "facets" : {  
> > "format" : {  
> > "\_type" : "terms",  
> > "missing" : 69,  
> > "total" : 125,  
> > "other" : 0,  
> > "terms" : [ {  
> > "term" : "undecided",  
> > "count" : 98  
> > }, {  
> > "term" : "b",  
> > "count" : 27  
> > } ]  
> > }  
> > }
> > 
> > Here again only "B" and "Undecided" values are considered.
> > 
> > --@surya
> > 
> > On Monday, July 1, 2013 9:42:03 PM UTC+5:30, Ivan Brusic wrote:
> > 
> > > If you are using the default Standard analyzer, then "a" is treated as a  
> > > stop word and ignored. Another analyzer (perhaps custom) is better suited  
> > > for your field.
> > > 
> > > --  
> > > Ivan
> > > 
> > > On Mon, Jul 1, 2013 at 8:34 AM, Kumar Surya Mani [ksury...@gmail.com](mailto:ksury...@gmail.com)wrote:
> > > 
> > > > Hi!
> > > > 
> > > > I have a document indexed which has field BayesianAnalysers and the  
> > > > field data is stored as following:
> > > > 
> > > > "BayesianAnalysers":[{"Safety"**:[{"text":"Undecided"}],"**  
> > > > Power":[{"text":"Undecided"}],**"Freedom":[{"text":"A"}],"**  
> > > > Growth":[{"text":"B"}],"**Subscribe":[{"text":"**  
> > > > Undecided"}],"Desire":[{"text"**:"Undecided"}],"Intent":[{"**  
> > > > text":"B"}],"Sentiment":[{"\*\*text":"Undecided"}]
> > > > 
> > > > When I run search query or Terms Facet for field values having value  
> > > > "A", example in the case above, BayesianAnalysers.Freedom.\*\*text="A";  
> > > > it fails to search however for the field values "B" or "Undecided", it  
> > > > works fine. I used Java API as well and this results same ☹
> > > > 
> > > > Please suggest and let me know if need any additional input.
> > > > 
> > > > regards,  
> > > > surya
> > > > 
> > > > --  
> > > > 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](http://googlegroups.com).
> > > > 
> > > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[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:28am UTC](https://discuss.elastic.co/t/unable-to-search-and-terms-facet-for-a-field-value-a-of-the-indexed-document/12603/6 "2017-07-06T02:28:45Z")

</div>


