Understaning terms syntax

Hi All

Im having the following scenario (elasticsearch 1.0):
the query
"query": {
"term": {
"ac": "3A822F3B-3ECF-4463-98F86DF6DE28EC5C"
}
}

yields no results

but this works

"query": {
"query_string" : {
"default_field" : "ac",
"query" : "3A822F3B-3ECF-4463-98F86DF6DE28EC5C"
}
}

the problem is when I combine it with a "must_not" or "not" filter I still
get the same results

what is the correct syntax I need?

Thanks

GX

--
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/a1f4c507-f85a-4ebd-b71f-4962259abf5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi GX,

“term" query does NOT analyzed your string.
See: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-term-query.html#query-dsl-term-query

On the other hand, “query_string” query analyze your string.

If you want to know the difference, you can use _validate API.
See : http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-validate.html#search-validate

Example commands are as follows:

GET hoge/fuga/_validate/query?explain
{
"query": {
"term": {
"ac": "3A822F3B-3ECF-4463-98F86DF6DE28EC5C"
}
}
}

GET hoge/fuga/_validate/query?explain
{
"query": {
"query_string" : {
"default_field" : "ac",
"query" : "3A822F3B-3ECF-4463-98F86DF6DE28EC5C"
}
}
}

I hope that those help you out.


Jun Ohtani
johtani@gmail.com
blog : http://blog.johtani.info
twitter : http://twitter.com/johtani

2014/11/21 14:45、GX mailme.gx@gmail.com のメール:

Hi All

Im having the following scenario (elasticsearch 1.0):
the query
"query": {
"term": {
"ac": "3A822F3B-3ECF-4463-98F86DF6DE28EC5C"
}
}

yields no results

but this works

"query": {
"query_string" : {
"default_field" : "ac",
"query" : "3A822F3B-3ECF-4463-98F86DF6DE28EC5C"
}
}

the problem is when I combine it with a "must_not" or "not" filter I still get the same results

what is the correct syntax I need?

Thanks

GX

--
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/a1f4c507-f85a-4ebd-b71f-4962259abf5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/634B3D51-39A8-469D-938A-A6F5BCDA2D67%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Hi Jun,

thanks for the reply will look into this

GX

On Saturday, December 6, 2014 3:53:10 PM UTC+2, Jun Ohtani wrote:

Hi GX,

“term" query does NOT analyzed your string.
See:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-term-query.html#query-dsl-term-query

On the other hand, “query_string” query analyze your string.

If you want to know the difference, you can use _validate API.
See :
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-validate.html#search-validate

Example commands are as follows:

GET hoge/fuga/_validate/query?explain
{
"query": {
"term": {
"ac": "3A822F3B-3ECF-4463-98F86DF6DE28EC5C"
}
}
}

GET hoge/fuga/_validate/query?explain
{
"query": {
"query_string" : {
"default_field" : "ac",
"query" : "3A822F3B-3ECF-4463-98F86DF6DE28EC5C"
}
}
}

I hope that those help you out.


Jun Ohtani
joh...@gmail.com <javascript:>
blog : http://blog.johtani.info
twitter : http://twitter.com/johtani

2014/11/21 14:45、GX <mail...@gmail.com <javascript:>> のメール:

Hi All

Im having the following scenario (elasticsearch 1.0):
the query
"query": {
"term": {
"ac": "3A822F3B-3ECF-4463-98F86DF6DE28EC5C"
}
}

yields no results

but this works

"query": {
"query_string" : {
"default_field" : "ac",
"query" : "3A822F3B-3ECF-4463-98F86DF6DE28EC5C"
}
}

the problem is when I combine it with a "must_not" or "not" filter I
still get the same results

what is the correct syntax I need?

Thanks

GX

--
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/a1f4c507-f85a-4ebd-b71f-4962259abf5a%40googlegroups.com.

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

--
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/9dfabbb3-ff0f-459c-bfbc-b69632076dda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Also, its usually better to use a "match" query if you want to analyze the
query rather than "query_string". Query string exposes a huge array of
syntax which is both useful and terribly dangerous. Users can write
regexes and huge range queries and fuzzy queries that use much much more
cpu and ram than the term and phrase queries you expect them to write.

Nik

On Sat, Dec 6, 2014 at 10:18 AM, GX mailme.gx@gmail.com wrote:

Hi Jun,

thanks for the reply will look into this

GX

On Saturday, December 6, 2014 3:53:10 PM UTC+2, Jun Ohtani wrote:

Hi GX,

“term" query does NOT analyzed your string.
See: http://www.elasticsearch.org/guide/en/elasticsearch/
reference/current/query-dsl-term-query.html#query-dsl-term-query

On the other hand, “query_string” query analyze your string.

If you want to know the difference, you can use _validate API.
See : http://www.elasticsearch.org/guide/en/elasticsearch/
reference/current/search-validate.html#search-validate

Example commands are as follows:

GET hoge/fuga/_validate/query?explain
{
"query": {
"term": {
"ac": "3A822F3B-3ECF-4463-98F86DF6DE28EC5C"
}
}
}

GET hoge/fuga/_validate/query?explain
{
"query": {
"query_string" : {
"default_field" : "ac",
"query" : "3A822F3B-3ECF-4463-98F86DF6DE28EC5C"
}
}
}

I hope that those help you out.


Jun Ohtani
joh...@gmail.com
blog : http://blog.johtani.info
twitter : http://twitter.com/johtani

2014/11/21 14:45、GX mail...@gmail.com のメール:

Hi All

Im having the following scenario (elasticsearch 1.0):
the query
"query": {
"term": {
"ac": "3A822F3B-3ECF-4463-98F86DF6DE28EC5C"
}
}

yields no results

but this works

"query": {
"query_string" : {
"default_field" : "ac",
"query" : "3A822F3B-3ECF-4463-98F86DF6DE28EC5C"
}
}

the problem is when I combine it with a "must_not" or "not" filter I
still get the same results

what is the correct syntax I need?

Thanks

GX

--
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/a1f4c507-f85a-4ebd-b71f-4962259abf5a%
40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/9dfabbb3-ff0f-459c-bfbc-b69632076dda%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/9dfabbb3-ff0f-459c-bfbc-b69632076dda%40googlegroups.com?utm_medium=email&utm_source=footer
.

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

--
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/CAPmjWd0rFhUPwAowxdi4Su_U%2Bvw1J6Ptr_r-EVe2f1jHqH-80w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.