本文整理汇总了Java中org.elasticsearch.search.aggregations.bucket.geogrid.GeoHashGridBuilder类的典型用法代码示例。如果您正苦于以下问题:Java GeoHashGridBuilder类的具体用法?Java GeoHashGridBuilder怎么用?Java GeoHashGridBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GeoHashGridBuilder类属于org.elasticsearch.search.aggregations.bucket.geogrid包,在下文中一共展示了GeoHashGridBuilder类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoHashGridBuilder; //导入依赖的package包/类
@Override
public AggregationBuilder convert(QueryConverter queryConverter, Aggregation aggregation) {
GeoHashGridBuilder result = AggregationBuilders.geohashGrid(getName(aggregation));
String field = aggregation.getString("field");
Integer precision = aggregation.getInteger("precision");
Integer size = aggregation.getInteger("size");
if (field != null) {
result.field(field);
}
if (precision != null) {
result.precision(precision);
}
if (size != null) {
result.size(size);
}
// not sure we really want to support sub-aggs, but we will
addSubAggs(queryConverter, aggregation, result);
return result;
}
示例2: convert
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoHashGridBuilder; //导入依赖的package包/类
@Override
public AggregationBuilder convert(QueryConverter queryConverter, Aggregation aggregation) {
GeoHashGridBuilder result = AggregationBuilders.geohashGrid(getName(aggregation));
String field = aggregation.getString("field");
Integer precision = aggregation.getInteger("precision");
Integer size = aggregation.getInteger("size");
if (field != null) {
result.field(field);
}
if (precision != null) {
result.precision(precision);
}
if (size != null) {
result.size(size);
}
result.subAggregation(stats("lat_stats").field(field + ".lat"));
result.subAggregation(stats("lon_stats").field(field + ".lon"));
// not sure we really want to support sub-aggs, but we will
addSubAggs(queryConverter, aggregation, result);
return result;
}
示例3: geohashGrid
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoHashGridBuilder; //导入依赖的package包/类
private AggregationBuilder<?> geohashGrid(MethodField field) throws SqlParseException {
String aggName = gettAggNameFromParamsOrAlias(field);
GeoHashGridBuilder 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":
break;
default:
throw new SqlParseException("geohash grid err or not define field " + kv.toString());
}
}
return geoHashGrid;
}
示例4: geohashGrid
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoHashGridBuilder; //导入依赖的package包/类
/**
* Create a new {@link GeoHashGrid} aggregation with the given name.
*/
public static GeoHashGridBuilder geohashGrid(String name) {
return new GeoHashGridBuilder(name);
}