1

私はESの初心者です。MongoDBに対してESを使用してジオサーチを行うJavaプログラムを作成しようとしていました(リバープラグインなどをインストールし、Javaプログラムを使用して通常の検索を取得できました)。緯度と経度の値が保存されているmongodbにコレクション(テーブル)があります.Javaプログラムから渡した緯度と経度に基づいてレコードを取得したいと思います。

    FilterBuilder filter =  FilterBuilders.geoDistanceFilter("pin.location").lat(10).lon(20).distance(5,DistanceUnit.KILOMETERS).geoDistance(GeoDistance.PLANE);

    SearchResponse response = client.prepareSearch(INDEX)
                                    .setTypes(TYPE)
                                    .setSearchType(SearchType.QUERY_AND_FETCH)
                                    .setQuery(matchAllQuery())
                                    .setPostFilter(filter)
                                    .setFrom(0).setSize(60).setExplain(true)
                                    .execute()
                                    .actionGet();

上記のプログラムを実行すると、「 QueryParsingException[[mongoindex] failed to find geo_point field [pin.location]];」というメッセージが表示されます。この pin.location は何ですか? また、私のmongodbテーブルには「緯度」と「経度」の列があります。しかし、上記のフィルターには「lat(10).lon(20)」があります。ここに何かが欠けています。理解してください。 .

フルスタック tarce:

},"説明":true}]]]; ネスト: QueryParsingException [[mongoindex] geo_point フィールド [pin.location] が見つかりませんでした]; 組織で.elasticsearch.search.action.SearchServiceTransportAction$12.handleException(SearchServiceTransportAction.java:351) で org.elasticsearch.transport.netty.MessageChannelHandler.handleException(MessageChannelHandler.java:185) で org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError( org.elasticsearch.transport.netty.MessageChannelHandler の MessageChannelHandler.java:175)。

ありがとう、スリ

4

2 に答える 2