Term Query Not Matching Certain Words

Not able to make any sense of this:

{"from":0,"size":20,"sort":{"created_time":"desc"},"query":{"term":{"tags":{"value":"permissions"}}}}

Returns as expected:

{"took":0,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":null,"hits":[{"_index":"blog","_type":"BlogPost","_id":"4a7a21b1-c20f-4131-9938-6306319f3102","_score":null,
"_source" : {
"year": 2013,
"month": 10,
"day": 17,
"created_time": 1382026481,
"id": "4a7a21b1-c20f-4131-9938-6306319f3102",
"tags": [
"permissions",
"UGC",
"photographer"
]
},"sort":[1382026481]}]}}

And:
{"from":0,"size":20,"sort":{"created_time":"desc"},"query":{"term":{"tags":{"value":"photographer"}}}}

returns as expected... but
{"from":0,"size":20,"sort":{"created_time":"desc"},"query":{"term":{"tags":{"value":"UGC"}}}}
returns nothing.

Tags is mapped simply as "tags":{"type":"string"}.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Try with ugc (lower case).

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 17 oct. 2013 à 20:40, Nariman Haghighi auspicious@gmail.com a écrit :

Not able to make any sense of this:

{"from":0,"size":20,"sort":{"created_time":"desc"},"query":{"term":{"tags":{"value":"permissions"}}}}

Returns as expected:

{"took":0,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":null,"hits":[{"_index":"blog","_type":"BlogPost","_id":"4a7a21b1-c20f-4131-9938-6306319f3102","_score":null, "_source" : {
"year": 2013,
"month": 10,
"day": 17,
"created_time": 1382026481,
"id": "4a7a21b1-c20f-4131-9938-6306319f3102",
"tags": [
"permissions",
"UGC",
"photographer"
]
},"sort":[1382026481]}]}}

And:
{"from":0,"size":20,"sort":{"created_time":"desc"},"query":{"term":{"tags":{"value":"photographer"}}}}

returns as expected... but {"from":0,"size":20,"sort":{"created_time":"desc"},"query":{"term":{"tags":{"value":"UGC"}}}} returns nothing.

Tags is mapped simply as "tags":{"type":"string"}.

--
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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.

Just so you know, the reason you need to lowercase ugc yourself is because
a term query is not analyzed. If you were to use a match query which is
analyzed, your query should work:

{"from":0,"size":20,"sort":{"created_time":"desc"},"query":{"match":{"tags":
"UGC"}}}

Thanks,
Matt Weber

On Thu, Oct 17, 2013 at 11:47 AM, David Pilato david@pilato.fr wrote:

Try with ugc (lower case).

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 17 oct. 2013 à 20:40, Nariman Haghighi auspicious@gmail.com a écrit :

Not able to make any sense of this:

{"from":0,"size":20,"sort":{"created_time":"desc"},"query":{"term":{"tags":{"value":"permissions"}}}}

Returns as expected:

{"took":0,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":null,"hits":[{"_index":"blog","_type":"BlogPost","_id":"4a7a21b1-c20f-4131-9938-6306319f3102","_score":null,
"_source" : {
"year": 2013,
"month": 10,
"day": 17,
"created_time": 1382026481,
"id": "4a7a21b1-c20f-4131-9938-6306319f3102",
"tags": [
"permissions",
"UGC",
"photographer"
]
},"sort":[1382026481]}]}}

And:

{"from":0,"size":20,"sort":{"created_time":"desc"},"query":{"term":{"tags":{"value":"photographer"}}}}

returns as expected... but
{"from":0,"size":20,"sort":{"created_time":"desc"},"query":{"term":{"tags":{"value":"UGC"}}}}
returns nothing.

Tags is mapped simply as "tags":{"type":"string"}.

--
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.
For more options, visit 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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.