我正在尝试使用Percolator并且不仅检索perculator id而且检索整个原始查询.
这是我的查询:
curl -XPUT 'localhost:9200/my-index/.percolator/1' -d '{
"query" : {
"match" : {
"message" : "bonsai tree"
}
},
"moreInfo": {
"foo": "bar"
}
}'
Run Code Online (Sandbox Code Playgroud)
找到匹配的文档后,我得到了这个:
{
"took" : 19,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"total" : 1,
"matches" : [
{
"_index" : "my-index",
"_id" : "1"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我真正感兴趣的是moreInfo查询的一部分.我知道我可以在一个额外的请求中查询elasticsearch,但直接拥有它会很棒,如下所示:
{
"took" : 19,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"total" : 1,
"matches" : [
{
"query" : {
"match" : {
"message" : "bonsai tree"
}
},
"moreInfo": {
"foo": "bar"
}
]
}
Run Code Online (Sandbox Code Playgroud)
有没有办法做到这一点?
非常好的一点,目前无法直接检索查询,但我们可能希望尽快添加它,因为您不是唯一一个要求它的人,而且它很有意义。有一个开放的问题已经描述了这个用例:https://github.com/elasticsearch/elasticsearch/issues/4317
| 归档时间: |
|
| 查看次数: |
211 次 |
| 最近记录: |