我正在尝试从两个 flex 搜索索引中获取数据。我得到以下查询。
但是,我希望每个索引有20个数据集作为结果
有什么规定吗?
以下是我的查询:
curl -X POST \
'http://localhost:9200/index1,index2/_search' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d '{
"query": {},
"from": 0,
"size": 20
}'
最佳答案
是肯定的。有一个多重搜索功能,使您可以一次发送两个(或多个)搜索请求(每个索引一个,每个10个结果)。响应将以完全相同的顺序包含所有查询的结果/结果。
请查看https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html以获取更多详细信息。
关于elasticsearch - 具有多个索引的 Elasticsearch 大小选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56542673/