Package org.elasticsearch.index.query

Examples of org.elasticsearch.index.query.GeoDistanceFilterBuilder


      paramDoublesDecay[1] = -1.0;
      paramDoublesDecay[2] = -1.0;
    }
    if ((null != geoDecay) && (null != parentFilterObj)) { // Regardless of high/low accuracy, add 0.5% filter
     
      GeoDistanceFilterBuilder geoFilter = FilterBuilders.geoDistanceFilter(EntityPojo.docQuery_geotag_).
                          point(geoDecay[0], geoDecay[1]).distance(200.0/geoDecay[2], DistanceUnit.KILOMETERS);
     
      parentFilterObj.must(FilterBuilders.nestedFilter(DocumentPojo.entities_, geoFilter));
     
    }//TESTED
View Full Code Here


        return res;
    }

    public List<JTweet> searchGeo(double lat, double lon, double length) {
        GeoDistanceFilterBuilder geoFilter = FilterBuilders.geoDistanceFilter("geo").
                lat(lat).lon(lon).distance(length, DistanceUnit.KILOMETERS).geoDistance(GeoDistance.PLANE);
        SearchRequestBuilder srb = createSearchBuilder();
        srb.setQuery(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), geoFilter));
        return collectObjects(srb.execute().actionGet());
    }
View Full Code Here

                assertThat(Index1Type1.find.byId("1").name).isEqualTo("name1");
                assertThat(Index1Type1.find.byId("2").name).isEqualTo("name1");

                IndexQuery<Index1Type1> query = Index1Type1.find.query();
                query.setBuilder(QueryBuilders.queryString("name1"));
                GeoDistanceFilterBuilder filter = FilterBuilders.geoDistanceFilter("type1.location")
                        .point(30, -88)
                        .distance(100, DistanceUnit.KILOMETERS);

                F.Promise<IndexResults<Index1Type1>> indexResultsPromise = Index1Type1.find.searchAsync(query, filter);
                IndexResults<Index1Type1> index1Type1IndexResults = indexResultsPromise.get(2L, TimeUnit.SECONDS);
View Full Code Here

    refresh();

    // Action
    SearchResponse searchResponse = client().prepareSearch(INDEX_NAME).setTypes(ESEntityType.NODE.getIndiceName())
        .setQuery(QueryBuilders.matchAllQuery())
        .setPostFilter(new GeoDistanceFilterBuilder("centroid").point(48.675652, 2.384955).distance(20, DistanceUnit.METERS))
        .execute().actionGet();

    // Assert
    Assert.assertEquals(1, searchResponse.getHits().hits().length);
  }
View Full Code Here

    refresh();

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

    // Assert
    Assert.assertEquals(0, searchResponse.getHits().hits().length);
  }
View Full Code Here

    refresh();

    // 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);
View Full Code Here

TOP

Related Classes of org.elasticsearch.index.query.GeoDistanceFilterBuilder

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.