geo_points の配列を持つ Elasticsearch ドキュメントがあります。マッピングを次のように作成しました。
{
"test": {
"properties": {
"locations": {
"type": "geo_point"
}
}
}
}
今、geo_points の配列に対して何らかの処理を行いたいクエリを作成しようとしています。次のようにクエリを作成しました。
{
"query": {
"filtered": {
"filter": {
"script": {
"script": "sDistance = doc['locations'].values[0].distanceInKm(28.51818,77.096080);"
}
}
}
}
}
位置配列の最初の要素からポイント (28.51818,77.096080) までの距離を計算したいと考えています。
それは私にこのエラーを与えています:
GroovyScriptExecutionException[MissingMethodException[メソッドのシグネチャはありません: org.elasticsearch.common.geo.GeoPoint.distanceInKm() は引数の型に適用されます: (java.lang.Double, java.lang.Double) 値: [28.51818, 77.09608]]
使用してみsDistance = doc['locations'][0].distanceInKm(28.51818,77.096080);
ましたが、同じエラーが発生しました。
ここで何が間違っていますか?
前もって感謝します。