我正在尝试使用Percolator,不仅检索perculator id,还检索整个原始查询。
这是我的疑问:
curl -XPUT 'localhost:9200/my-index/.percolator/1' -d '{
"query" : {
"match" : {
"message" : "bonsai tree"
}
},
"moreInfo": {
"foo": "bar"
}
}'
找到匹配的文件后,我明白了:
{
"took" : 19,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"total" : 1,
"matches" : [
{
"_index" : "my-index",
"_id" : "1"
}
]
}
我真正感兴趣的是查询的moreInfo
部分。我知道我可以在另外的请求中查询elasticsearch,但直接拥有它会很棒,如下所示:
{
"took" : 19,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"total" : 1,
"matches" : [
{
"query" : {
"match" : {
"message" : "bonsai tree"
}
},
"moreInfo": {
"foo": "bar"
}
]
}
有办法吗?
答案 0 :(得分:2)
非常好的一点,目前无法直接检索查询,但这是我们可能希望尽快添加的内容,因为您不是唯一一个要求它的人,这很有意义。有一个问题已经打开,它已经描述了这个用例:https://github.com/elasticsearch/elasticsearch/issues/4317