elasticsearch 如何知道ElasticsSearch中哪些关键字匹配,elasticsearch,lucene,text-mining,nosql,elasticsearch,Lucene,Text Mining,Nosql" /> elasticsearch 如何知道ElasticsSearch中哪些关键字匹配,elasticsearch,lucene,text-mining,nosql,elasticsearch,Lucene,Text Mining,Nosql" />

elasticsearch 如何知道ElasticsSearch中哪些关键字匹配

elasticsearch 如何知道ElasticsSearch中哪些关键字匹配,elasticsearch,lucene,text-mining,nosql,elasticsearch,Lucene,Text Mining,Nosql,说我质疑: POST /story/story/_search { "query":{ "bool":{ "should":[ { "match":{ "termVariations":{ "query":"not driving", "type":"boole

说我质疑:

POST /story/story/_search
{  
   "query":{  
      "bool":{  
         "should":[  
            {  
               "match":{  
                  "termVariations":{  
                     "query":"not driving",
                     "type":"boolean",
                     "operator":"AND"
                  }
               }
            },
            {  
               "match":{  
                  "termVariations":{  
                     "query":"driving",
                     "type":"boolean",
                     "operator":"AND"
                  }
               }
            }
         ]
      }
   }
}
此查询由一个分析器或其他3个文档返回。 我如何判断哪个should子句匹配?Elasticsearch能否将匹配的短语与结果一起返回


谢谢

谢谢@keety!这正是我想要的!!:-)

这里最好的选择是。 您可以命名查询,并且每个文档将提供匹配查询的名称

{
  "query": {
    "bool": {
      "should": [
        {
          "match": {
            "name.first": {
              "query": "qbox",
              "_name": "first"
            }
          }
        },
        {
          "match": {
            "name.last": {
              "query": "search",
              "_name": "last"
            }
          }
        }
      ]
    }
  }
}

这里没有帮助吗?我看到elastic有explain API(),但这对我的需求来说是一种过分的方式,它会让我迭代我得到的每一个结果,因为它是每一个文档……检查我的答案,高亮显示对于这种任务来说是昂贵的,而且是过分的。尼斯忘记了
命名查询
。太好了!:)我想知道是什么让highlight和这个相比如此昂贵。