【发布时间】:2019-07-03 12:01:06
【问题描述】:
我正在尝试编写 Elasticsearch 布尔查询。我在使用 bool must query 查询字段 (DATE) 时遇到问题。 弹性搜索数据如下所示:
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 15,
"successful": 15,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 11.519888,
"hits": [
{
"_index": "test-2019.06.27",
"_type": "test",
"_id": "pa6gmGsByDlvLvAyiRF-",
"_score": 11.519888,
"_source": {
"DATE": "01/06/19"
}
}
]
}
}
这样的 Elasticsearch 查询:
{
"query":
{
"bool" : {
"must" : [
{
"match" : {
"DATE" : {
"query" : "01/06/19",
"operator" : "AND",
"prefix_length" : 0,
"max_expansions" : 50,
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"auto_generate_synonyms_phrase_query" : true,
"boost" : 1.0
}
}
}
],
"adjust_pure_negative" : true,
"boost" : 1.0
}
}
}
查询不工作。 请问有什么办法吗?
【问题讨论】:
-
你能分享你的映射细节吗?只需执行
GET test-2019.06.27/_mapping并更新上述问题中的响应即可。
标签: elasticsearch