【问题标题】:"Elasticsearch" search documents before index refresh索引刷新前的“Elasticsearch”搜索文档
【发布时间】:2016-08-24 11:45:05
【问题描述】:

我正在编写一个 php 应用程序,将数据存储在 Elasticsearch 中。我希望能够实时搜索来自 elasticsearch 的最新索引数据(没有索引刷新时间障碍)。我如何实现这样的功能?

注意:以下内容无助于实现实时性

$client->indices()->refresh();

也没有

'refresh'   => true

-- Elasticsearch V2.3

-- 我正在使用官方的 PHP Elasticsearch 驱动

【问题讨论】:

    标签: php elasticsearch


    【解决方案1】:

    您可以使用以下查询为任何索引设置刷新间隔。 . .但通常在批量索引文档时,此值将更改为-1,这意味着从不刷新,我将手动刷新。因为低刷新率可能会导致索引率的性能下降。 通过以下链接了解更多详情 https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html#bulk

    `

    curl -XPUT localhost:9200/test/_settings -d '{
        "index" : {
            "refresh_interval" : "1s"
        } }'
    

    `

    【讨论】:

    • 嗯,这意味着刷新完成后数据将可用于搜索(从数据被索引到数据可用于搜索的延迟)。有什么办法可以减少延迟?
    • 我认为没有其他方法。 . .
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-27
    • 1970-01-01
    • 2021-05-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多