我一直在使用 Elasticsearch 7.6 和 PHP 客户端 API 进行所有操作。我创建了弹性搜索索引设置和映射如下
$params = [
'index' => $index,
'body' => [
'settings' => [
"number_of_shards" => 1,
"number_of_replicas" => 0,
"index.queries.cache.enabled" => false,
"index.soft_deletes.enabled" => false,
"index.refresh_interval" => -1,
"index.requests.cache.enable" => false,
"index.max_result_window"=> 2000000
],
'mappings' => [
'_source' => [
"enabled" => false
],
'properties' => [
"text" => [
"type" => "text",
"index_options" => "docs"
]
]
]
]
];
我的布尔 OR 搜索查询如下
$json = '{
"from" : 0, "size" : 2000000,
"query": {
"bool": {
"filter": {
"match" : {
"text" : {
"query" : "apple orange grape banana",
"operator" : "or"
}
}
}
}
}
}';
我已经索引了 200 万份文档,所有文档都与查询匹配,并且我也按预期获取了所有文档。由于我匹配所有文档,因此我通过在 bool 查询中使用过滤器来避免评分。
但是在我的日志文件中,我反复收到以下消息,直到查询完成执行。有时我在批量索引文档时会收到相同的消息
[2020-05-15T19:15:45,720][INFO ][o.e.m.j.JvmGcMonitorService] [node1] [gc][14] overhead, spent [393ms] collecting in the last [1.1s]
[2020-05-15T19:15:47,822][INFO ][o.e.m.j.JvmGcMonitorService] [node1] [gc][16] overhead, spent [399ms] collecting in the last [1s]
[2020-05-15T19:15:49,827][INFO ][o.e.m.j.JvmGcMonitorService] [node1] [gc][18] overhead, spent [308ms] collecting in the last [1s]
我为我的堆内存分配了 16 GB。elasticsearch 日志中未显示其他警告。可能是什么原因?还是在检索大量文档时预期?我了解滚动 API,但我很好奇为什么当我为 index.max_result_window 使用大值时会发生这种情况。非常感谢帮助?提前致谢!