# Is this a bug or working as expected

**URL:** <https://discuss.elastic.co/t/is-this-a-bug-or-working-as-expected/3540>\
**Category:** Elasticsearch\
**Created:** [November 9, 2010, 4:52pm UTC](https://discuss.elastic.co/t/is-this-a-bug-or-working-as-expected/3540 "2010-11-09T16:52:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diptamay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/diptamay/32/2805_2.png) [@Diptamay](https://discuss.elastic.co/u/Diptamay)\
**Post date:** [November 9, 2010, 4:52pm UTC](https://discuss.elastic.co/t/is-this-a-bug-or-working-as-expected/3540/1 "2010-11-09T16:52:40Z")

</div>

Hi Shay

Please checkout [https://github.com/diptamay/es-issue](https://github.com/diptamay/es-issue)

## Steps to setup and run queries:

1. Ensure ES is running at localhost:9200
2. run ./automate.sh  
a) This will create an es-test index and load the sample data.  
b) Then it fire ./not\_working.sh to run the query which is not  
working as desired.  
c) It will then delete the documents.

## Issues:

i) The first query is searching for the text "A-Rod" globally.  
Expected that only document 10990239 would be returned. But the  
document 10990695 is returned as well since it has the word "Rod". If  
you look at ./working.sh, you will see the difference between the  
working and not working version, is that "fields.kicker" is used  
instead of "\_all". And this works as expected by returning only  
document 10990239. Probably this is expected behavior because of the  
special field "\_all". Is that so?  
ii) The second query adds on to the first query and add the additional  
criteria that I want all documents which have state = "A" (aka active  
or "D" for disabled). Expected that only document 10990239 would be  
returned. But nothing was returned. What could be the issue here?

Thanks  
Diptamay

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [November 9, 2010, 10:24pm UTC](https://discuss.elastic.co/t/is-this-a-bug-or-working-as-expected/3540/2 "2010-11-09T22:24:04Z")

</div>

Answers below:

On Tue, Nov 9, 2010 at 6:52 PM, diptamay [diptamay@gmail.com](mailto:diptamay@gmail.com) wrote:

> Hi Shay
> 
> Please checkout [GitHub - diptamay/es-issue: Sample code to communicate issues with ES](https://github.com/diptamay/es-issue)
> 
> ## Steps to setup and run queries:
> 
> 1. Ensure ES is running at localhost:9200
> 2. run ./automate.sh  
> a) This will create an es-test index and load the sample data.  
> b) Then it fire ./not\_working.sh to run the query which is not  
> working as desired.  
> c) It will then delete the documents.
> 
> ## Issues:
> 
> i) The first query is searching for the text "A-Rod" globally.  
> Expected that only document 10990239 would be returned. But the  
> document 10990695 is returned as well since it has the word "Rod". If  
> you look at ./working.sh, you will see the difference between the  
> working and not working version, is that "fields.kicker" is used  
> instead of "\_all". And this works as expected by returning only  
> document 10990239. Probably this is expected behavior because of the  
> special field "\_all". Is that so?

Yes, thats how it would work... .

> ii) The second query adds on to the first query and add the additional  
> criteria that I want all documents which have state = "A" (aka active  
> or "D" for disabled). Expected that only document 10990239 would be  
> returned. But nothing was returned. What could be the issue here?

Its because that field is analyzed by default, and "a" is a stop word, so it  
gets removed. You would want to have this type of fields specified as index  
"not\_analyzed" in the mapping.

> Thanks  
> Diptamay

---

<div class="post-metadata">

**Author:** ![Diptamay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/diptamay/32/2805_2.png) [@Diptamay](https://discuss.elastic.co/u/Diptamay)\
**Post date:** [November 10, 2010, 12:02am UTC](https://discuss.elastic.co/t/is-this-a-bug-or-working-as-expected/3540/3 "2010-11-10T00:02:53Z")

</div>

Thanks for the help. The mappings change did the trick.

Cheers!  
Diptamay

On Nov 9, 5:24 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Answers below:
> 
> On Tue, Nov 9, 2010 at 6:52 PM, diptamay [dipta...@gmail.com](mailto:dipta...@gmail.com) wrote:
> 
> > Hi Shay
> 
> > Please checkouthttps://github.com/diptamay/es-issue
> 
> > ## Steps to setup and run queries:
> > 
> > 1. Ensure ES is running at localhost:9200
> > 2. run ./automate.sh  
> > a) This will create an es-test index and load the sample data.  
> > b) Then it fire ./not\_working.sh to run the query which is not  
> > working as desired.  
> > c) It will then delete the documents.
> 
> > ## Issues:
> > 
> > i) The first query is searching for the text "A-Rod" globally.  
> > Expected that only document 10990239 would be returned. But the  
> > document 10990695 is returned as well since it has the word "Rod". If  
> > you look at ./working.sh, you will see the difference between the  
> > working and not working version, is that "fields.kicker" is used  
> > instead of "\_all". And this works as expected by returning only  
> > document 10990239. Probably this is expected behavior because of the  
> > special field "\_all". Is that so?
> 
> Yes, thats how it would work... .
> 
> > ii) The second query adds on to the first query and add the additional  
> > criteria that I want all documents which have state = "A" (aka active  
> > or "D" for disabled). Expected that only document 10990239 would be  
> > returned. But nothing was returned. What could be the issue here?
> 
> Its because that field is analyzed by default, and "a" is a stop word, so it  
> gets removed. You would want to have this type of fields specified as index  
> "not\_analyzed" in the mapping.
> 
> > Thanks  
> > Diptamay

---

<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, 4:16am UTC](https://discuss.elastic.co/t/is-this-a-bug-or-working-as-expected/3540/4 "2017-07-06T04:16:51Z")

</div>


