弾性検索を使用して、計算されたdistance
フィールドをジオ検索に追加しようとしています。私は検索ドキュメントに追加の計算フィールドを追加したいだけですが、 "script_fields"で計算フィールドを追加すると、そのフィールドだけが返されます。弾性検索でスクリプトフィールドを使用するときにすべてのフィールドを返す方法
ワイルドカードフィールドの部分を追加しようとしましたが、結果には影響しませんでした。
このクエリを作成するには、追加計算フィールドを追加してcomplete documents
を返しますか?
GET /ocsm_test/inventory/_search
{
"query": {
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "2km",
"address.geo.location": [],
"loc.address.geo.location": [
151.2165507,
-33.8732887
]
}
}
}
},
"aggs": {
"partNumber": {
"terms": {
"field": "partNumber",
"order": {
"_term": "asc"
}
}
},
"location": {
"terms": {
"field": "loc.identifier",
"order": {
"_term": "asc"
}
}
}
},
"script_fields": {
"distance": {
"params": {
"lat": -33.8732887,
"lon": 151.2165507
},
"script": "doc['loc.address.geo.location'].distanceInKm(lat,lon)"
}
},
"fields": [
".*"
],
"post_filter": {
"bool": {
"must": [
{
"term": {
"partNumber": "p-0099393-3"
}
}
]
}
}
}
' "_source" を使用してみてください:仕事を代わりに' "フィールド" ' – Val
のtrue'を、感謝ヴァル代わりにこの本
利用ですから
、。 –