映射包含不应分析的嵌套字段(不确定“not_analyzed”值是否准确)。是否可以对嵌套字段进行精确匹配?在 "metadata.value": "2014.NWJSD.47" 下面的查询中仍然被分析。Elasticsearch 将字符串分解为几个术语(“2014”、“NWJSD”、“47”)。我尝试使用“term”而不是“match”,但这没有返回任何结果。
"mappings" : {
"metadata" : {
"type" : "nested",
"properties" : {
"name" : {
"type" : "text",
"index" : "not_analyzed"
},
"value" : {
"type" : "text",
"index" : "not_analyzed"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
查询:
"query": {
"bool": {
"must": [
{
"nested": {
"path": "metadata",
"query": {
"bool": {
"must": [
{
"match": {
"metadata.name": "number"
}
},
{
"match": {
"metadata.value": "2014.NWJSD.47"
}
}
]
}
}
}
}
]
}
}
Run Code Online (Sandbox Code Playgroud)