Package org.elasticsearch.common.geo

Examples of org.elasticsearch.common.geo.GeoPoint


  public static String encode(double lat, double lon) {
    return org.elasticsearch.common.geo.GeoHashUtils.encode(lat, lon);
  }
 
  public static double[] decode(String geohash) {
    GeoPoint x = org.elasticsearch.common.geo.GeoHashUtils.decode(geohash);
    double retVal[] = { x.getLat(), x.getLon() };
    return retVal;
  }
View Full Code Here


                type1.dateCreate = date;

                // this is to go around the known bug in elasticsearch 1.1:
                // https://github.com/elasticsearch/elasticsearch/issues/5680#issuecomment-39794200
                // Issue is fixed on ES 1.1.1
                GeoPoint location = new GeoPoint(30.6943566,-88.0430541);
                type1.location = location;

                // indexing
                IndexResponse index = type1.index();
View Full Code Here

    public void asynchronousIndex() {
        running(esFakeApplication(), new Runnable() {
            @Override
            public void run() {
                Index1Type1 index1Type1 = new Index1Type1("1", "name1", "category", new Date());
                GeoPoint location = new GeoPoint(30.6943566,-88.0430541);
                index1Type1.location = location;

                Index1Type1 index1Type1Bis = new Index1Type1("2", "name2", "category", new Date());
                index1Type1Bis.location = location;
View Full Code Here

    @Test
    public void asynchronousIndexBulk() {
        running(esFakeApplication(), new Runnable() {
            @Override
            public void run() {
                GeoPoint location = new GeoPoint(30.6943566,-88.0430541);
                Index1Type1 index1Type1 = new Index1Type1("1", "name1", "category", new Date(),location);
                Index1Type1 index1Type1Bis = new Index1Type1("2", "name2", "category", new Date(),location);
                Index1Type1 index1Type1Ter = new Index1Type1("3", "name3", "category", new Date(),location);

                F.Promise<BulkResponse> promise = IndexService.indexBulkAsync(
View Full Code Here

    @Test
    public void asynchronousDelete() {
        running(esFakeApplication(), new Runnable() {
            @Override
            public void run() {
                GeoPoint location = new GeoPoint(30.6943566,-88.0430541);
                Index1Type1 index1Type1 = new Index1Type1("1", "name1", "category", new Date(), location);
                Index1Type1 index1Type1Bis = new Index1Type1("2", "name2", "category", new Date(), location);
                Index1Type1 index1Type1Ter = new Index1Type1("3", "name3", "category", new Date(), location);
                IndexService.indexBulk(index1Type1.getIndexPath(), Arrays.asList(index1Type1, index1Type1Bis, index1Type1Ter));
View Full Code Here

    @Test
    public void asynchronousGet() {
        running(esFakeApplication(), new Runnable() {
            @Override
            public void run() {
                GeoPoint location = new GeoPoint(30.6943566,-88.0430541);
                Index1Type1 index1Type1 = new Index1Type1("1", "name1", "category", new Date(), location);
                Index1Type1 index1Type1Bis = new Index1Type1("2", "name2", "category", new Date(), location);
                Index1Type1 index1Type1Ter = new Index1Type1("3", "name3", "category", new Date(), location);
                IndexService.indexBulk(index1Type1.getIndexPath(), Arrays.asList(index1Type1, index1Type1Bis, index1Type1Ter));
View Full Code Here

    @Test
    public void asynchronousSearch() {
        running(esFakeApplication(), new Runnable() {
            @Override
            public void run() {
                GeoPoint location = new GeoPoint(30.6943566,-88.0430541);
                Index1Type1 index1Type1 = new Index1Type1("1", "name1", "category", new Date(), location);
                index1Type1.index();
                IndexService.refresh();

                IndexQuery<Index1Type1> query = new IndexQuery<Index1Type1>(Index1Type1.class);
View Full Code Here

        running(esFakeApplication(), new Runnable() {

            @Override
            public void run() {
                // Blocking
                GeoPoint location = new GeoPoint(30.6943566,-88.0430541);
                Index1Type1 index1Type1 = new Index1Type1("1", "name1", "category", new Date(),location);
                index1Type1.index();
                Map<String, Object> fieldNewValues = new HashMap<>();
                fieldNewValues.put("name", "new-name");
                String updateScript = "ctx._source.name = name";
View Full Code Here

    @Test
    public void searchWithGeoFilter() {
        running(esFakeApplication(), new Runnable() {
            @Override
            public void run() {
                GeoPoint location = new GeoPoint(30.6943566,-88.0430541);
                Index1Type1 index1Type1 = new Index1Type1("1", "name1", "category", new Date(), location);
                index1Type1.index();

                location = new GeoPoint(12.6943566,-10.0430541);
                Index1Type1 index1Type2 = new Index1Type1("2", "name1", "category", new Date(), location);
                index1Type2.index();

                // refresh the index so the documents appear in the search results
                IndexService.refresh();
View Full Code Here

                XContentBuilder postBuilder = XContentFactory.jsonBuilder().startObject()
                        .field("id", dso.getID())
                        .field("typeIndex", dso.getType())
                        .field("type", dso.getTypeText())

                        .field("geo", new GeoPoint(latitude, longitude))
                        .field("continent", continent)
                        .field("countryCode", countryCode)
                        .field("country", country)
                        .field("city", city)
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.geo.GeoPoint

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.