我用的chrome的elasticsearch-head插件,使用简单查询 query_string 指定type为question的时候可以找到正确结果,但是使用constant_score复合查询时就没有结果。为什么呢?
这是查询DSL:
{
"bool" : {
"should" : [ {
"constant_score" : {
"filter" : {
"match" : {
"question" : {
"query" : "你",
"type" : "boolean"
}
}
}
}
}, {
"constant_score" : {
"filter" : {
"match" : {
"question" : {
"query" : "觉得",
"type" : "boolean"
}
}
}
}
}, {
"constant_score" : {
"filter" : {
"match" : {
"question" : {
"query" : "我",
"type" : "boolean"
}
}
}
}
}, {
"constant_score" : {
"filter" : {
"match" : {
"question" : {
"query" : "怎么样",
"type" : "boolean"
}
}
}
}
} ]
}
}
这是查询DSL:
{
"bool" : {
"should" : [ {
"constant_score" : {
"filter" : {
"match" : {
"question" : {
"query" : "你",
"type" : "boolean"
}
}
}
}
}, {
"constant_score" : {
"filter" : {
"match" : {
"question" : {
"query" : "觉得",
"type" : "boolean"
}
}
}
}
}, {
"constant_score" : {
"filter" : {
"match" : {
"question" : {
"query" : "我",
"type" : "boolean"
}
}
}
}
}, {
"constant_score" : {
"filter" : {
"match" : {
"question" : {
"query" : "怎么样",
"type" : "boolean"
}
}
}
}
} ]
}
}
0 个回复