获取单项 ElasticSearch 的分数

Get Score for Single Entry ElasticSearch

所以,我有一个由 3 个元素组成的基本 elasticsearch 索引

我知道如何针对 elasticsearch 编写查询来对文档进行排名,但是如果我想知道 1 个特定的 URL 在该查询上的表现如何呢?例如,假设 ID 为 2394823 的 http://www.google.com 在索引中,我想知道它在查询 "search engine"

中的分数

这在 ElasticSearch 中可行吗?

进行过滤查询,查看内容中的 "search engine" 但过滤 url 值:

POST myindex/_search
{
    "filtered": {
        "query": {
            "match": { "content": "search engine" }
         },
         "filter": {
             "term": { "url": { "http://www.google.com" }}
         }
     }
}

唯一的结果应该是google对应的一个元素。从响应 JSON 中提取分数,您就完成了。