本文整理汇总了Java中org.elasticsearch.search.aggregations.support.ValuesSource.GeoPoint类的典型用法代码示例。如果您正苦于以下问题:Java GeoPoint类的具体用法?Java GeoPoint怎么用?Java GeoPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GeoPoint类属于org.elasticsearch.search.aggregations.support.ValuesSource包,在下文中一共展示了GeoPoint类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.elasticsearch.search.aggregations.support.ValuesSource.GeoPoint; //导入依赖的package包/类
@Override
public AggregatorFactory parse(String aggregationName, XContentParser parser, SearchContext context) throws IOException {
ValuesSourceParser<GeoPoint> vsParser = ValuesSourceParser.geoPoint(aggregationName, InternalConvexHull.TYPE, context)
.targetValueType(ValueType.GEOPOINT)
.formattable(true)
.build();
XContentParser.Token token;
String currentFieldName = null;
while((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (vsParser.token(currentFieldName, token, parser)) {
continue;
}
}
return new ConvexHullAggregator.Factory(aggregationName, vsParser.config());
}
示例2: GeoHashGridAggregatorFactory
import org.elasticsearch.search.aggregations.support.ValuesSource.GeoPoint; //导入依赖的package包/类
GeoHashGridAggregatorFactory(String name, ValuesSourceConfig<GeoPoint> config, int precision, int requiredSize,
int shardSize, SearchContext context, AggregatorFactory<?> parent, AggregatorFactories.Builder subFactoriesBuilder,
Map<String, Object> metaData) throws IOException {
super(name, config, context, parent, subFactoriesBuilder, metaData);
this.precision = precision;
this.requiredSize = requiredSize;
this.shardSize = shardSize;
}
示例3: doCreateInternal
import org.elasticsearch.search.aggregations.support.ValuesSource.GeoPoint; //导入依赖的package包/类
@Override
protected Aggregator doCreateInternal(final ValuesSource.GeoPoint valuesSource, Aggregator parent, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException {
if (collectsFromSingleBucket == false) {
return asMultiBucketAggregator(this, context, parent);
}
CellIdSource cellIdSource = new CellIdSource(valuesSource, precision);
return new GeoHashGridAggregator(name, factories, cellIdSource, requiredSize, shardSize, context, parent,
pipelineAggregators, metaData);
}
示例4: parse
import org.elasticsearch.search.aggregations.support.ValuesSource.GeoPoint; //导入依赖的package包/类
@Override
public AggregatorFactory parse(String aggregationName, XContentParser parser, SearchContext context) throws IOException {
ValuesSourceParser<GeoPoint> vsParser = ValuesSourceParser.geoPoint(aggregationName, InternalGeoBounds.TYPE, context)
.targetValueType(ValueType.GEOPOINT)
.formattable(true)
.build();
boolean wrapLongitude = true;
XContentParser.Token token;
String currentFieldName = null;
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (vsParser.token(currentFieldName, token, parser)) {
continue;
} else if (token == XContentParser.Token.VALUE_BOOLEAN) {
if ("wrap_longitude".equals(currentFieldName) || "wrapLongitude".equals(currentFieldName)) {
wrapLongitude = parser.booleanValue();
} else {
throw new SearchParseException(context, "Unknown key for a " + token + " in aggregation [" + aggregationName + "]: ["
+ currentFieldName + "].", parser.getTokenLocation());
}
} else {
throw new SearchParseException(context, "Unknown key for a " + token + " in aggregation [" + aggregationName + "]: ["
+ currentFieldName + "].", parser.getTokenLocation());
}
}
return new GeoBoundsAggregator.Factory(aggregationName, vsParser.config(), wrapLongitude);
}