当前位置: 首页>>代码示例>>Java>>正文


Java AggregationBuilders.geohashGrid方法代码示例

本文整理汇总了Java中org.elasticsearch.search.aggregations.AggregationBuilders.geohashGrid方法的典型用法代码示例。如果您正苦于以下问题:Java AggregationBuilders.geohashGrid方法的具体用法?Java AggregationBuilders.geohashGrid怎么用?Java AggregationBuilders.geohashGrid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.search.aggregations.AggregationBuilders的用法示例。


在下文中一共展示了AggregationBuilders.geohashGrid方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getElasticsearchGeohashAggregations

import org.elasticsearch.search.aggregations.AggregationBuilders; //导入方法依赖的package包/类
protected List<AggregationBuilder> getElasticsearchGeohashAggregations(GeohashAggregation agg) {
    List<AggregationBuilder> aggs = new ArrayList<>();
    PropertyDefinition propertyDefinition = getPropertyDefinition(agg.getFieldName());
    if (propertyDefinition == null) {
        throw new MemgraphException("Unknown property " + agg.getFieldName() + " for geohash aggregation.");
    }
    if (propertyDefinition.getDataType() != GeoPoint.class) {
        throw new MemgraphNotSupportedException("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;
}
 
开发者ID:mware-solutions,项目名称:memory-graph,代码行数:20,代码来源:ElasticsearchSearchQueryBase.java

示例2: getElasticsearchGeohashAggregations

import org.elasticsearch.search.aggregations.AggregationBuilders; //导入方法依赖的package包/类
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;
}
 
开发者ID:visallo,项目名称:vertexium,代码行数:20,代码来源:ElasticsearchSearchQueryBase.java

示例3: convert

import org.elasticsearch.search.aggregations.AggregationBuilders; //导入方法依赖的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;
}
 
开发者ID:scaleset,项目名称:scaleset-search,代码行数:21,代码来源:GeoHashGridAggregationConverter.java

示例4: convert

import org.elasticsearch.search.aggregations.AggregationBuilders; //导入方法依赖的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;
}
 
开发者ID:scaleset,项目名称:scaleset-search,代码行数:25,代码来源:GeoHashGridStatsAggregationConverter.java

示例5: geohashGrid

import org.elasticsearch.search.aggregations.AggregationBuilders; //导入方法依赖的package包/类
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;
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:31,代码来源:AggMaker.java

示例6: geohashGrid

import org.elasticsearch.search.aggregations.AggregationBuilders; //导入方法依赖的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;
}
 
开发者ID:selvakumarEsra,项目名称:es4sql,代码行数:28,代码来源:AggMaker.java


注:本文中的org.elasticsearch.search.aggregations.AggregationBuilders.geohashGrid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。