後拉最新數據Elasticsearch(V 2.3),每當我索引的新文件才能60秒是能夠將其納入我的過濾結果中。我怎樣才能減少延遲時間爲零?Elasticsearch搜索延遲從<strong>5秒</strong>索引
這裏是我的索引查詢
# Document Body
$data = [];
$data['time'] = $time;
$data['unique'] = 1;
$data['lastACtivity'] = $time;
$data['bucket'] = 20,
$data['permission'] = $this->_user->permission; # Extracts User Permission
$data['ipaddress'] = $this->_client->ipaddress(); # Extracts User IP Address
# Construct Index
$indexRequest = [
'index' => 'gorocket',
'type' => 'log',
'refresh' => true,
'body' => $data
];
# Indexing Document
$confirmation = $client->index($indexRequest);
這裏是我的搜索過濾器查詢
# Query array
$query =[ 'query' => [
'filtered' => [
'filter' => [
'bool' => [
'must' =>[
[
'match' => [ 'unique' => 1 ]
],
[
'range' => [
'lastACtivity' => [
'gte' => $from,
'lte' => $to
],
'_cache' => false
]
]
],
'must_not' => [
[ 'match' => [ 'type' => 'share' ] ],
]
]
]
]
]
];
# Prepare filter parameters
$filterParams = [
'index' => 'gorocket',
'type' => 'log',
'size' => 20,
'query_cache' => false,
'body' => $query
];
$client->search($filterParams);
謝謝。
儘管添加'refresh'=> true,但延遲仍然存在@Val –
您可以顯示一些代碼來說明您在做什麼嗎? – Val
我編輯了問題以包含代碼示例。 @Val –