gpt4 book ai didi

elasticsearch - Elasticsearch甚至在5-6秒后仍提供缓存的结果

转载 作者:行者123 更新时间:2023-12-02 22:21:39 25 4
gpt4 key购买 nike

我的系统正在调用elasticsearch。更新文档后,我想再次获取同一文档。这样做时,即使重试5-6秒后得到的Elasticsearch值,有时Elasticsearch也会获取缓存的结果(更新之前的结果)。

我在更新文档时使用了refresh:'wait_for'。谁能帮我解决这个问题的办法?我想获取更新文档的最新版本。我要提取的查询是:

body: {
query: {
terms: {
_id: [
idsToFetch
]
}
}
}

最佳答案

首先,您可以检查为索引设置的刷新间隔默认为1秒,在这种情况下:refresh:wait_for最多应返回1秒,但如官方ES文档中所述:

If the refresh interval is set to -1, disabling the automatic refreshes, then requests with refresh=wait_for will wait indefinitely until some action causes a refresh. Conversely, setting index.refresh_interval to something shorter than the default like 200ms will make refresh=wait_for come back faster, but it’ll still generate inefficient segment



您可以使用 https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-settings.html来获取为索引设置的refresh_interval内容。请注意,只有将其未设置为默认值时,它才会出现在结果中。

让我知道您是否遇到任何问题或有更多疑问。

关于elasticsearch - Elasticsearch甚至在5-6秒后仍提供缓存的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59368112/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com