我在文档中应用了bigram分析器并使用自定义分数来嵌套数组字段,其中与查询匹配的对数是从doc.freq(使用的相似脚本分数)获得的.score_mode是max,因此在数组中最大对数匹配的计数会得到。现在我需要获取score_mode max达到对象的字段长度的字段长度
"PenNames": {
"Name": [
"niraav modi"
],
"Aliasname": [
"Nirav Modi",
"Modi Nirav",
"shris"
],
"AliasnameLength": [
"Nirav Modi",
"Modi Nirav",
"shris"
]
},
"PenAddresses": [
{
"addressLine": "DAMAVAND TEHRAN HIGHWAY",
"city": "TEHRAN",
"state": "ADILABAD",
"country": "MASKAD",
"pinCode": 2829303,
"addressLineLength": "DAMAVAND TEHRAN HIGHWAY"
},
{
"addressLine": "KM 5 OF KHAN ROAD",
"city": "HRAN",
"state": "YAHD",
"country": "ARGENTINA",
"pinCode": 3930320,
"addressLineLength": "KM 5 OF KHAN ROAD"
}
]
},
here _score will be 2* doc.freq value here it is 12
GET /negativelistwitharrayobj/details/_search
{
"query": {
"nested": {
"inner_hits": {
"_source" : true
},
"path": "PenAddresses",
"score_mode":"max",
"query": {
"function_score": {
"script_score": {
"script": {
"source": "(_score)"
}
},
"query": {
"match": { "PenAddresses.addressLine": "DAMAVAND
TEHRAN" }
}
}
}
}
} }
我需要知道长度“ addressLine”:“ DAMAVAND TEHRAN HIGHWAY” ...并在脚本中使用