2016-08-23 100 views
0

我写一个PHP 应用Elasticsearch存储数据。我希望能够实时搜索来自elasticsearch的最新索引数据(没有索引刷新时间障碍)。我如何实现这样的功能?“Elasticsearch”搜索文件索引刷新

注:以下从来没有帮助实现真正的timeness

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

'refresh' => true 

- Elasticsearch V2.3

- 我使用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" 
    } }' 

`

+0

嗯,这意味着数据将可用于搜索刷新完成后(从数据被延迟索引到数据何时可用于搜索)。有什么办法可以减少延误吗? –

+1

我不认为有任何其他的方式。 。 。 –