private AggregationBuilder geohashGrid(MethodField field) throws SqlParseException { String aggName = gettAggNameFromParamsOrAlias(field); GeoGridAggregationBuilder geoHashGrid = AggregationBuilders.geohashGrid(aggName); String value = null; for (KVValue kv : field.getParams()) { value = kv.value.toString(); switch (kv.key.toLowerCase()) { case "precision": geoHashGrid.precision(Integer.parseInt(value)); break; case "field": geoHashGrid.field(value); break; case "size": geoHashGrid.size(Integer.parseInt(value)); break; case "shard_size": geoHashGrid.shardSize(Integer.parseInt(value)); break; case "alias": case "nested": case "reverse_nested": case "children": break; default: throw new SqlParseException("geohash grid err or not define field " + kv.toString()); } } return geoHashGrid; }
protected List<AggregationBuilder> getElasticsearchGeohashAggregations(GeohashAggregation agg) { List<AggregationBuilder> aggs = new ArrayList<>(); for (String propertyName : getPropertyNames(agg.getFieldName())) { String visibilityHash = getSearchIndex().getPropertyVisibilityHashFromDeflatedPropertyName(propertyName); String aggName = createAggregationName(agg.getAggregationName(), visibilityHash); GeoHashGridBuilder geoHashAgg = AggregationBuilders.geohashGrid(aggName); geoHashAgg.field(propertyName + Elasticsearch2SearchIndex.GEO_PROPERTY_NAME_SUFFIX); geoHashAgg.precision(agg.getPrecision()); aggs.add(geoHashAgg); } return aggs; }
private AggregationBuilder geohashGrid(MethodField field) throws SqlParseException { String aggName = gettAggNameFromParamsOrAlias(field); GeoGridAggregationBuilder geoHashGrid = AggregationBuilders.geohashGrid(aggName); String value = null; for (KVValue kv : field.getParams()) { value = kv.value.toString(); switch (kv.key.toLowerCase()) { case "precision": geoHashGrid.precision(Integer.parseInt(value)); break; case "field": geoHashGrid.field(value); break; case "size": geoHashGrid.size(Integer.parseInt(value)); break; case "shard_size": geoHashGrid.shardSize(Integer.parseInt(value)); break; case "alias": case "nested": case "reverse_nested": case "children": break; default: throw new SqlParseException("geohash grid err or not define field " + kv.toString()); } } return geoHashGrid; }
protected List<AggregationBuilder> getElasticsearchGeohashAggregations(GeohashAggregation agg) { List<AggregationBuilder> aggs = new ArrayList<>(); for (String propertyName : getPropertyNames(agg.getFieldName())) { String visibilityHash = getSearchIndex().getPropertyVisibilityHashFromDeflatedPropertyName(propertyName); String aggName = createAggregationName(agg.getAggregationName(), visibilityHash); GeoHashGridBuilder geoHashAgg = AggregationBuilders.geohashGrid(aggName); geoHashAgg.field(propertyName + ElasticsearchSingleDocumentSearchIndex.GEO_PROPERTY_NAME_SUFFIX); geoHashAgg.precision(agg.getPrecision()); aggs.add(geoHashAgg); } return aggs; }
protected List<AggregationBuilder> getElasticsearchGeohashAggregations(GeohashAggregation agg) { List<AggregationBuilder> aggs = new ArrayList<>(); PropertyDefinition propertyDefinition = getPropertyDefinition(agg.getFieldName()); if (propertyDefinition == null) { throw new VertexiumException("Unknown property " + agg.getFieldName() + " for geohash aggregation."); } if (propertyDefinition.getDataType() != GeoPoint.class) { throw new VertexiumNotSupportedException("Only GeoPoint properties are valid for Geohash aggregation. Invalid property " + agg.getFieldName()); } for (String propertyName : getPropertyNames(agg.getFieldName())) { String visibilityHash = getSearchIndex().getPropertyVisibilityHashFromPropertyName(propertyName); String aggName = createAggregationName(agg.getAggregationName(), visibilityHash); GeoGridAggregationBuilder geoHashAgg = AggregationBuilders.geohashGrid(aggName); geoHashAgg.field(propertyName + Elasticsearch5SearchIndex.GEO_POINT_PROPERTY_NAME_SUFFIX); geoHashAgg.precision(agg.getPrecision()); aggs.add(geoHashAgg); } return aggs; }
protected List<AggregationBuilder> getElasticsearchGeohashAggregations(GeohashAggregation agg) { List<AggregationBuilder> aggs = new ArrayList<>(); PropertyDefinition propertyDefinition = getPropertyDefinition(agg.getFieldName()); if (propertyDefinition == null) { throw new VertexiumException("Unknown property " + agg.getFieldName() + " for geohash aggregation."); } if (propertyDefinition.getDataType() != GeoPoint.class) { throw new VertexiumNotSupportedException("Only GeoPoint properties are valid for Geohash aggregation. Invalid property " + agg.getFieldName()); } for (String propertyName : getPropertyNames(agg.getFieldName())) { String visibilityHash = getSearchIndex().getPropertyVisibilityHashFromPropertyName(propertyName); String aggName = createAggregationName(agg.getAggregationName(), visibilityHash); GeoGridAggregationBuilder geoHashAgg = AggregationBuilders.geohashGrid(aggName); geoHashAgg.field(propertyName + Elasticsearch5SearchIndex.GEO_POINT_PROPERTY_NAME_SUFFIX); geoHashAgg.precision(agg.getPrecision()); aggs.add(geoHashAgg); } return aggs; }
GeoHashGridBuilder agg = AggregationBuilders.geohashGrid(geohashQueryItem.getAggregationName()); agg.field(geohashQueryItem.getFieldName()); agg.precision(geohashQueryItem.getPrecision());
GeoHashGridBuilder agg = AggregationBuilders.geohashGrid(geohashQueryItem.getAggregationName()); agg.field(geohashQueryItem.getFieldName()); agg.precision(geohashQueryItem.getPrecision());
GeoHashGridBuilder agg = AggregationBuilders.geohashGrid(geohashQueryItem.getAggregationName()); agg.field(geohashQueryItem.getFieldName()); agg.precision(geohashQueryItem.getPrecision());
GeoHashGridBuilder agg = AggregationBuilders.geohashGrid(geohashQueryItem.getAggregationName()); agg.field(geohashQueryItem.getFieldName()); agg.precision(geohashQueryItem.getPrecision());