简体   繁体   English

统计 Elasticsearch 中特定字段中的 SEARCH 词/短语

[英]Counting the SEARCH term/phrase in a specific field in Elasticsearch

I have this type of data我有这种类型的数据

{
    "name_id": 2145
    "address": "Antartica"
    "characteristics" : "He is a very nice person with very nice personality. the nicest thing about him is his nice dog"
}

now I am running this query现在我正在运行这个查询

GET friends/_search
{
  "query": {
    "bool": {
      "must": [
        {"term": {
          "name_id.keyword": "B08F2BWX2V"
        }
        },
        {
          "match_phrase": {
            "characteristics": "nice"
          }
        }
      ]
    }
  }
}

is there a way i can get the results and the word count ie, nice: 4有没有办法我可以获得结果和字数,即,很好:4

There is an elastic api that can return the token count information you need.有一个elastic api 可以返回你需要的token计数信息。 It is the Term vectors API .它是术语向量 API I'm not sure if it will be exactly what you need but I saw in the post below a question similar to yours: https://stackoverflow.com/a/69734423/18778181我不确定它是否正是您所需要的,但我在下面的帖子中看到了一个与您的问题类似的问题: https://stackoverflow.com/a/69734423/18778181

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM