Question with terms filters and ids

I'm using elasticsearch-0.90.3 and had a question with the terms filter.

I'm storing the id of an author on a comment as such:
curl -XPUT localhost:9200/comments/comment/1 -d '{ "author" : "qQabqD5yRjCHUOxPgifKVA"}'
However, when I try to filter by terms using this field, I'm getting nothing back:

curl -XGET 'http://localhost:9200/comments/_search' -d '{
"query" : {
"filtered" {
"filter" : {
"terms" : {
"author" : ["qQabqD5yRjCHUOxPgifKVA"]
}
}
}
}
}'

{"took":0,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0}, "hits":{"total":0,"max_score":null,"hits":[]}}

If instead, I use a word (or name), it works out, though:
curl -XPUT localhost:9200/comments/comment/1 -d '{ "author" : "ruben"}'

curl -XGET 'http://localhost:9200/comments/_search' -d '{
"query" : {
"filtered" : {
"filter" : {
"terms" : {
"author" : ["ruben"]
}
}
}
}
}'

{"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0}, "hits":{"total":1,"max_score":1.0,"hits":[{"_index":"comments","_type": "comment","_id":"1","_score":1.0, "_source" : { "author" : "ruben"}}]}}

What am I doing wrong?

Thanks,

  • Ruben

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

The reason is that you are using the default analyzer to store your
document. So when you put 'qQabqD5yRjCHUOxPgifKVA' in the index, it is
actually stored as 'qqabqd5yrjchuoxpgifkva'. Later when you search the
original with term query, unanalyzed, it tries to match it to the exact
lower case document and it fails. You could repeat the last query with '
qqabqd5yrjchuoxpgifkva' and you will get result.

Obviously this is not the case for 'ruben' since it is lowercase.

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