Reputation: 735
I'm running into an issue in that I have a document indexed with elasticsearch and when I query against a multi-valued field, it returns no results. Here is my search:
curl -X GET "http://mncoboss13:9200/boss_model_reservations/_search?pretty=true" -d '{"query":{"match_all":{}},"filter":{"and":[{"terms":{"day_plan":["MO"]}}]},"size":100,"from":0}'
Results in:
{ "took" : 2, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 0, "max_score" : null, "hits" : [ ] } }
Here is the way I've indexed the document (notice that day_plan is an array of strings). Notice that even in the example below, it has a day_plan with MO within it; however, given the above search, is not returned. Am I doing something wrong with my filter?
http://mncoboss13:9200/boss_model_reservations/_search?pretty=true&q=*&size=1
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 27493,
"max_score" : 1.0,
"hits" : [ {
"_index" : "boss_model_reservations",
"_type" : "boss_model_reservation",
"_id" : "779588",
"_score" : 1.0, "_source" : {"name":"","upccode":"701592001542","publish":true,"reservation_type":"class","time_start":37200.0,"time_end":39000.0,"date_start":"2012-07-19","date_end":"2012-07-30","day_plan":["MO","TU","WE","TH"]}
} ]
}
}
UPDATE: The Type mapping for this index is here:
{
"boss_model_reservations" : {
"boss_model_reservation" : {
"properties" : {
"date_end" : {
"type" : "date",
"format" : "dateOptionalTime"
},
"date_start" : {
"type" : "date",
"format" : "dateOptionalTime"
},
"day_plan" : {
"type" : "string"
},
"format_id" : {
"type" : "long"
},
"interest_id" : {
"type" : "long"
},
"name" : {
"type" : "string"
},
"option1" : {
"type" : "string"
},
"option2" : {
"type" : "string"
},
"option3" : {
"type" : "string"
},
"product_line_id" : {
"type" : "long"
},
"product_type" : {
"type" : "string"
},
"publish" : {
"type" : "boolean"
},
"reservation_type" : {
"type" : "string"
},
"resource" : {
"type" : "string"
},
"resource_type" : {
"type" : "string"
},
"time_end" : {
"type" : "double"
},
"time_start" : {
"type" : "double"
},
"upccode" : {
"type" : "string"
}
}
}
}
}
Upvotes: 1
Views: 1707
Reputation: 3624
What's the type mapping for "boss_model_reservation"? The term filter assumes the field "day_plan" is not analyzed.
Upvotes: 3