【发布时间】:2019-04-02 06:24:42
【问题描述】:
我对 elasticsearch 相当陌生,我需要在 match_phrase 查询中使用模糊性,但没有找到合适的帮助文档。由于我的映射也是嵌套的,因此我可以轻松获得正确的查询。
映射
{
"mappings":{
"type":{
"properties":{
"Id":{
"type":"integer"
},
"custom":{
"type":"nested",
"properties":{
"text":{
"type":"text"
},
"start_time":{
"type":"text"
},
"end_time":{
"type":"text"
}
}
}
}
}
}
}
发布http://localhost:9200/transcripts/type/_search
{
"query":{
"nested":{
"path":"custom",
"query":{
"match_phrase":{
"custom.text":"search something here",
"fuzziness":"2"
}
},
"inner_hits":{
"highlight":{
"fields":{
"custom.start_time":{}
}
}
}
}
}
}
输出
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[match_phrase] query doesn't support multiple fields, found [custom.text] and [fuzziness]",
"line": 8,
"col": 26
}
],
"type": "parsing_exception",
"reason": "[match_phrase] query doesn't support multiple fields, found [custom.text] and [fuzziness]",
"line": 8,
"col": 26
},
"status": 400
}
【问题讨论】:
-
检查我的答案!希望有帮助!
标签: elasticsearch postman