Why the speed of geoDistanceQuery is not increasing?

Hi ,I tested the geoDistanceQuery performance locally then found that it cost similar time to query 500,000 data or 2,000,000 data even through different amounts of data returned.

geo-query filter distance is 100km(ms)
DistanceQuery(query 500,000 data) 3797(return 387,351 data)
DistanceQuery(query 1,000,000 data) 3760(return 774,842 data)
DistanceQuery(query 2,000,000 data) 3820(return 1,550,922 data)

this is my test code:

public static void testDistanceQuery(GeoQuery geoQuery,String index,String dis) {
        int distance=Integer.parseInt(dis);
        QueryBuilder geo_dt_qb = QueryBuilders.geoDistanceQuery("location").point(40, -70).distance(distance, DistanceUnit.KILOMETERS);
        SearchRequest searchRequest = new SearchRequest();

        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();


        SearchResponse searchResponse = geoQuery.queryReturnResponse(searchRequest);
        System.out.println("testDistanceQuery end! " + searchResponse.getHits().getTotalHits().value);

I think with the increase of the data set, the query time should be longer, but from the test, the time has not increased. Why is this? Thank you!:slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.