有什么方法可以从scripted_field访问命中匹配项(来自命名查询)吗?
例如,在这里我希望能够访问“Test1”和“Test2”:
{
"_index": "mail_161212",
"_type": "mail",
"_id": "c166fa1e-0357-4398-9b1e-54eebb573c3a",
"_score": 0,
"fields": {
"test_field": [
"?"
]
},
"matched_queries": [
"Test1",
"Test2"
]
}
提前致谢
最佳答案
如果查看 SearchModule
implementation,则会看到脚本字段的获取阶段在匹配查询的获取阶段之前执行,因此,脚本字段无法访问匹配查询(因为匹配查询信息不会存在)。
关于elasticsearch - 从script_field访问matched_queries,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41264740/