Package org.elasticsearch.search.sort

Examples of org.elasticsearch.search.sort.GeoDistanceSortBuilder


    // Action
    SearchResponse searchResponse = client().prepareSearch(INDEX_NAME).setTypes(ESEntityType.NODE.getIndiceName())
        .setQuery(QueryBuilders.matchAllQuery())
        .setPostFilter(new GeoDistanceFilterBuilder("centroid").point(48.676455, 2.380899).distance(1, DistanceUnit.KILOMETERS))
        .addSort(new GeoDistanceSortBuilder("centroid").point(48.676455, 2.380899).unit(DistanceUnit.METERS))
        .execute().actionGet();

    // Assert
    Assert.assertEquals(2, searchResponse.getHits().hits().length);
    Assert.assertEquals("1854801717", searchResponse.getHits().getAt(0).getId());
View Full Code Here

TOP

Related Classes of org.elasticsearch.search.sort.GeoDistanceSortBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.