Why do term queries and query_string queries produce different results for the same query?


(project2501) #1

If I have a term query that is simple text:people
and then I have a query_string that is also "text:people" they produce
different number of results.

Why is that?

thank you!

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2999d8e5-fea8-4e8a-b928-dfb8391056e6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jun Ohtani) #2

Hi,

term query is not analyze a given term, directly search inverted index.
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-term-query.html

query_string query is analyze a given term using analyzer defined the field
(your example : "text").
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html

What kind of analyzer is "text" field?

regards,

Jun Ohtani

2013/12/13 project2501 darreng5150@gmail.com

If I have a term query that is simple text:people
and then I have a query_string that is also "text:people" they produce
different number of results.

Why is that?

thank you!

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/2999d8e5-fea8-4e8a-b928-dfb8391056e6%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--

Jun Ohtani
blog : http://blog.johtani.info

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAPW8A5z4_rXqEHBw2AK%3D%2BWXPS8fr7ibjaVqEaGVsw9oFdgszhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(project2501) #3

snowball

On Friday, December 13, 2013 9:59:27 AM UTC-5, Jun Ohtani wrote:

Hi,

term query is not analyze a given term, directly search inverted index.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-term-query.html

query_string query is analyze a given term using analyzer defined the
field (your example : "text").

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html

What kind of analyzer is "text" field?

regards,

Jun Ohtani

2013/12/13 project2501 <darre...@gmail.com <javascript:>>

If I have a term query that is simple text:people
and then I have a query_string that is also "text:people" they produce
different number of results.

Why is that?

thank you!

--
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 <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/2999d8e5-fea8-4e8a-b928-dfb8391056e6%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--

Jun Ohtani
blog : http://blog.johtani.info

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e72d0a6d-1cf0-4769-9aab-ece6c8fef347%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jun Ohtani) #4

Hi

snowball analyzer stem last "e".

You run following command :
http://localhost:9200/_analyze?analyzer=snowball&text=people&pretty

You receive following response.

{
"tokens" : [ {
"token" : "peopl",
"start_offset" : 0,
"end_offset" : 6,
"type" : "",
"position" : 1
} ]
}

query_string query search "peopl" term, but term query search "people".
If you use term "peopl", then the number of results using term query is
equal the number of results using query_string query.

regards,

2013/12/14 project2501 darreng5150@gmail.com

snowball

On Friday, December 13, 2013 9:59:27 AM UTC-5, Jun Ohtani wrote:

Hi,

term query is not analyze a given term, directly search inverted index.
http://www.elasticsearch.org/guide/en/elasticsearch/
reference/current/query-dsl-term-query.html

query_string query is analyze a given term using analyzer defined the
field (your example : "text").
http://www.elasticsearch.org/guide/en/elasticsearch/
reference/current/query-dsl-query-string-query.html

What kind of analyzer is "text" field?

regards,

Jun Ohtani

2013/12/13 project2501 darre...@gmail.com

If I have a term query that is simple text:people
and then I have a query_string that is also "text:people" they produce
different number of results.

Why is that?

thank you!

--
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.

To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/2999d8e5-fea8-4e8a-b928-dfb8391056e6%
40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--

Jun Ohtani
blog : http://blog.johtani.info

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/e72d0a6d-1cf0-4769-9aab-ece6c8fef347%40googlegroups.com
.

For more options, visit https://groups.google.com/groups/opt_out.

--

Jun Ohtani
blog : http://blog.johtani.info

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAPW8A5wPevPVP_skn3BiSReRMFHKnaBq95%2BNUQveagwMXTB2eQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(project2501) #5

Thank you for the help. Very appreciated! It makes a lot of sense now.

On Friday, December 13, 2013 10:15:20 AM UTC-5, Jun Ohtani wrote:

Hi

snowball analyzer stem last "e".

You run following command :
http://localhost:9200/_analyze?analyzer=snowball&text=people&pretty

You receive following response.

{
"tokens" : [ {
"token" : "peopl",
"start_offset" : 0,
"end_offset" : 6,
"type" : "",
"position" : 1
} ]
}

query_string query search "peopl" term, but term query search "people".
If you use term "peopl", then the number of results using term query is
equal the number of results using query_string query.

regards,

2013/12/14 project2501 <darre...@gmail.com <javascript:>>

snowball

On Friday, December 13, 2013 9:59:27 AM UTC-5, Jun Ohtani wrote:

Hi,

term query is not analyze a given term, directly search inverted index.
http://www.elasticsearch.org/guide/en/elasticsearch/
reference/current/query-dsl-term-query.html

query_string query is analyze a given term using analyzer defined the
field (your example : "text").
http://www.elasticsearch.org/guide/en/elasticsearch/
reference/current/query-dsl-query-string-query.html

What kind of analyzer is "text" field?

regards,

Jun Ohtani

2013/12/13 project2501 darre...@gmail.com

If I have a term query that is simple text:people
and then I have a query_string that is also "text:people" they produce
different number of results.

Why is that?

thank you!

--
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.

To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/2999d8e5-fea8-4e8a-b928-dfb8391056e6%
40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--

Jun Ohtani
blog : http://blog.johtani.info

--
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 <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/e72d0a6d-1cf0-4769-9aab-ece6c8fef347%40googlegroups.com
.

For more options, visit https://groups.google.com/groups/opt_out.

--

Jun Ohtani
blog : http://blog.johtani.info

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2625f243-3b51-45cc-8666-aba072d4ec3d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #6