AWS OpenSearch/Elasticsearch Match_phrase_prefix Query doen' t适用于节点

发布于 2025-02-11 18:06:26 字数 1001 浏览 2 评论 0原文

我有一个具有4个碎片和3个数据节点的AWS Elasticsearch域。

shard 3与2个节点相关:xqvlrod1rocshwwwzlwxy4g和gn9dyu4ps22ggnedecg6rrq。

第一个查询返回预期的结果:

POST carat-prod/_search?preference=_shards:3|_only_nodes:xQVLroD1RoCShwwzLwXY4g
{
  "explain": true,
  "query": {
    "match_phrase_prefix": {
      "content": {
        "query": "10 Blahblahblah Avenue Apt. 42 Banana, NJ 0700"
      }
    }
  }
}

但是第二个查询没有返回:

POST carat-prod/_search?preference=_shards:3|_only_nodes:gn9dYu4pS22gNEDeCg6RrQ
{
  "explain": true,
  "query": {
    "match_phrase_prefix": {
      "content": {
        "query": "10 Blahblahblah Avenue Apt. 42 Banana, NJ 0700"
      }
    }
  }
}

查询的唯一区别是指定的节点。

实际上,目标文档包含该行(NJ 0700之后附加1):

10 Blahblahblah Avenue Apt. 42 Banana, NJ 07001

如果我尝试搜索,则

10 Blahblahblah Avenue Apt. 42 Banana, NJ 07001

我的两个节点都会产生预期的结果。

有人有什么想法,为什么会这样吗?

I have an AWS ElasticSearch domain with 4 shards and 3 data nodes.

The shard 3 linked with 2 nodes: xQVLroD1RoCShwwzLwXY4g and gn9dYu4pS22gNEDeCg6RrQ.

The first query returns the expected result:

POST carat-prod/_search?preference=_shards:3|_only_nodes:xQVLroD1RoCShwwzLwXY4g
{
  "explain": true,
  "query": {
    "match_phrase_prefix": {
      "content": {
        "query": "10 Blahblahblah Avenue Apt. 42 Banana, NJ 0700"
      }
    }
  }
}

But the second one returns nothing:

POST carat-prod/_search?preference=_shards:3|_only_nodes:gn9dYu4pS22gNEDeCg6RrQ
{
  "explain": true,
  "query": {
    "match_phrase_prefix": {
      "content": {
        "query": "10 Blahblahblah Avenue Apt. 42 Banana, NJ 0700"
      }
    }
  }
}

The only difference in the queries is the specified node.

Actually, the target document contains the line (additional 1 after NJ 0700):

10 Blahblahblah Avenue Apt. 42 Banana, NJ 07001

If I try to search for

10 Blahblahblah Avenue Apt. 42 Banana, NJ 07001

I have the expected result from the both nodes.

Does anyone have any ideas why this might be so?

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

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

发布评论

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

评论(1

挽梦忆笙歌 2025-02-18 18:06:26

请分享您的索引映射和设置,没有这些映射和设置,很难回答您的问题。

一些解决方案:

  1. 尝试刷新您要查询的索引,这可能是由于过时的索引所致。
  2. 我不知道一次可以在两个节点上进行碎片。主碎片只能在一个节点上生存。它的复制品可能生活在其他节点上,但在这种情况下它们并不重要。
  3. 文档只能在一个主碎片上生存,因此您可能要查询的是两个不同的节点,但是该文档仅存在于一个节点中的主碎片中。
  4. 在索引文档时,您是否给出了节点/碎片偏​​好?

Hth

Please share your index mappings and settings, without these it is very difficult to answer your question.

Some solutions:

  1. Try to refresh the index that you are querying, this may be due to a stale index.
  2. I don't know how a shard can be on two nodes at a time. A primary shard can only live on one node. Its replicas may live on other nodes, but they don't really matter in this case.
  3. A document can only live on one primary shard, so what you are probably querying are two different nodes, but the document is only present in the primary shard in one node.
  4. Did you give a node/shard preference while indexing the document?

HTH

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文