如何获取 Lucene表达式中的数字多值字段中的所有值。默认情况下,它返回最小值。而且我可以要求平均值,最小值或最大值,但不能要求所有值。
基本上,我将向量存储为多值数字字段,并希望对该向量进行一些计算。
我看到类似的问题处理Java中的类似问题,但我的问题专门针对Lucene Expressions(它是Javascript的一个子集)。
示例:
PUT employees
{
"settings":{
"number_of_shards": 1,
"number_of_replicas": 0
}
}
PUT employees/_mapping/map1'
{
"properties": {
"age": {
"type": "integer"
},
"name": {
"type": "keyword"
},
"skills": {
"type": "integer"
}
}
}
PUT employees/sales/1/
{
"age":521,
"name":"James1",
"skills":[5,1]
}
PUT employees/sales/2/
{
"age":522,
"name":"James1",
"skills":[4,10]
}
POST employees/_search
{
"query": {
"function_score": {
"boost_mode": "replace",
"functions": [
{
"script_score": {
"script": {
"inline": "doc['skills'].value",
"lang": "expression",
"params": {
}
}
}
}
],
"query": {
"match_all": {}
},
"score_mode": "sum"
}
}
}
谢谢, 9月