为什么此查询有0个命中?

发布于 2025-01-31 03:07:54 字数 429 浏览 3 评论 0原文

我有一个名为“大学”的索引中的“学生” ID的文件。该文档具有以下内容:

{
   "1234567": {
      name: "Jack",
      subject: "Computer Engineering"
   }
   "7654321": {
      name: "John",
      subject: "Computer Engineering"
   }
}

我想搜索带有名称“ John”的学生。我在Kibana中提出了以下查询:

GET /university/_search
{
   "query": {
      "match": {
         "*.name": "John"
      }
   }
}

但是此查询有0个命中。为什么?什么是正确的查询?

I have a document with ID of "students" in an index named "university". The document has the following content:

{
   "1234567": {
      name: "Jack",
      subject: "Computer Engineering"
   }
   "7654321": {
      name: "John",
      subject: "Computer Engineering"
   }
}

I want to search for students with name "John". I came up with the following query in Kibana:

GET /university/_search
{
   "query": {
      "match": {
         "*.name": "John"
      }
   }
}

But this query has 0 hits. Why? What is the correct query?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

2025-02-07 03:07:54

匹配查询不支持通配的字段名称。使用 /代码> 而不是:

GET /university/_search
{
   "query": {
      "multi_match": {
         "query":    "John", 
         "fields": [ "*.name" ] 
      }
   }
}

The match query doesn't support wildcarded field names. Use multi_match instead:

GET /university/_search
{
   "query": {
      "multi_match": {
         "query":    "John", 
         "fields": [ "*.name" ] 
      }
   }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文