Question with terms filter

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/questions/_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":"questions","_type":
"question","_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.

Change your mapping and don't analyze your field.

It´s using standard analyzer by default which lowercase your content.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 29 août 2013 à 03:55, rfq jsmithy275@gmail.com a écrit :

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/questions/_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":"questions","_type":"question","_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.

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