Is this a bug or working as expected


(Diptamay) #1

Hi Shay

Please checkout 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


(Shay Banon) #2

Answers below:

On Tue, Nov 9, 2010 at 6:52 PM, diptamay diptamay@gmail.com wrote:

Hi Shay

Please checkout 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


(Diptamay) #3

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

Cheers!
Diptamay

On Nov 9, 5:24 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Answers below:

On Tue, Nov 9, 2010 at 6:52 PM, diptamay 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


(system) #4