我刚接触elastic search。如何为select * from响应where pnrno='sampleid'
生成弹性搜索等价查询
我知道我们必须在elastic search.but中使用'filter‘选项,我们不需要任何排名。(排名可以是常量)那么我如何生成查询来实现这一点
发布于 2015-11-30 14:09:25
您是正确的,您可以使用查询子句为空的过滤查询,拒绝一组文档是为了过滤查询操作所依据的集合,以进一步过滤/匹配和计算relevance.Filters类似于布尔匹配或拒绝(1/0)。
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [{
"term": {
"FIELD": "VALUE"
}
}]
}
}
}
}
}
发布于 2015-11-30 14:14:29
实现这一点的常用方法是使用带有嵌入式term
filter的constant_score
query,如下所示:
{
"query": {
"constant_score": {
"filter": {
"term": {
"pnrno": "sampleid"
}
}
}
}
}
https://stackoverflow.com/questions/33992293
复制相似问题