我遇到了一个问题,因为我有一个使用elasticsearch索引的文档,当我查询多值字段时,它不返回任何结果 . 这是我的搜索:
curl -X GET“http:// mncoboss13:9200 / boss_model_reservations / _search?pretty = true”-d'{“query”:{“match_all”:{}},“filter”:{“和”:[{ “术语”:{ “day_plan”:[ “MO”]}}]}, “大小”:100 “从”:0}”
结果是:
{“take”:2,“timed_out”:false,“_ shards”:{“total”:5,“success”:5,“failed”:0},“hits”:{“total”:0,“ max_score“:null,”点击“:[]}}
这是我索引文档的方式(注意day_plan是一个字符串数组) . 请注意,即使在下面的示例中,它也有一个带有MO的day_plan;但是,鉴于上述搜索,不予退还 . 我的过滤器出了问题吗?
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"]}
} ]
}
}
更新:此索引的类型映射在此处:
{
"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"
}
}
}
}
}
1 回答
什么是“boss_model_reservation”的类型映射?术语过滤器假设未分析字段“day_plan” .