假设我需要查询多个索引和doc,如下所示 我想将_source元素分组到它们自己的_index,_type作为父元素,但不知何故它给出了每个索引,在每个块中键入,我很难管理结果
GET /index_1,index_2,hockey,bookdb_index/_search?size=200
{
"_index": "hockey",
"_type": "player",
"_id": "10",
"_score": 1,
"_source": {
"first": "mikael",
"last": "backlund",
"goals": [
3,
15,
13
],
...
}
},
{
"_index": "bookdb_index",
"_type": "book",
"_id": "2",
"_score": 1,
"_source": {
"title": "Taming Text:...
}
},
如何将索引和类型分组为父级,_source是子元素
"hockey": {
"player": [{
"first": "mikael",
"last": "backlund",
"goals": [
3,
15,
13
] }
}, { "first": ...
}]
},
"bookdb_index": { ...
答案 0 :(得分:0)
我为此创建了客户端等等。
纯弹性搜索在nginx.conf中编写,弹性服务器上游,
您可以选择index_docs
来获得所需的结果。有关详细信息,请参阅自述文件。
location /test {
elastic_pass http://elastic_upstream;
elastic_send POST /testindex/testdoc/_search?size=100 index_docs;
elastic_query '{"query":
{
"match_all": {}
}
}';
}