Java Code Examples for org.elasticsearch.search.internal.SearchContext#bigArrays()
The following examples show how to use
org.elasticsearch.search.internal.SearchContext#bigArrays() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SignificantTermsAggregatorFactory.java From Elasticsearch with Apache License 2.0 | 6 votes |
/** * Creates the TermsEnum (if not already created) and must be called before any calls to getBackgroundFrequency * @param context The aggregation context * @return The number of documents in the index (after an optional filter might have been applied) */ public long prepareBackground(AggregationContext context) { if (termsEnum != null) { // already prepared - return return termsEnum.getNumDocs(); } SearchContext searchContext = context.searchContext(); IndexReader reader = searchContext.searcher().getIndexReader(); try { if (numberOfAggregatorsCreated == 1) { // Setup a termsEnum for sole use by one aggregator termsEnum = new FilterableTermsEnum(reader, indexedFieldName, PostingsEnum.NONE, filter); } else { // When we have > 1 agg we have possibility of duplicate term frequency lookups // and so use a TermsEnum that caches results of all term lookups termsEnum = new FreqTermsEnum(reader, indexedFieldName, true, false, filter, searchContext.bigArrays()); } } catch (IOException e) { throw new ElasticsearchException("failed to build terms enumeration", e); } return termsEnum.getNumDocs(); }
Example 2
Source File: DateHierarchyAggregator.java From elasticsearch-aggregation-pathhierarchy with MIT License | 6 votes |
public DateHierarchyAggregator( String name, AggregatorFactories factories, SearchContext context, ValuesSource.Numeric valuesSource, BucketOrder order, long minDocCount, BucketCountThresholds bucketCountThresholds, List<DateHierarchyAggregationBuilder.RoundingInfo> roundingsInfo, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData ) throws IOException { super(name, factories, context, parent, pipelineAggregators, metaData); this.valuesSource = valuesSource; this.roundingsInfo = roundingsInfo; this.minDocCount = minDocCount; bucketOrds = new BytesRefHash(1, context.bigArrays()); this.order = InternalOrder.validate(order, this); this.bucketCountThresholds = bucketCountThresholds; }
Example 3
Source File: PathHierarchyAggregator.java From elasticsearch-aggregation-pathhierarchy with MIT License | 6 votes |
public PathHierarchyAggregator( String name, AggregatorFactories factories, SearchContext context, ValuesSource valuesSource, BucketOrder order, long minDocCount, BucketCountThresholds bucketCountThresholds, BytesRef separator, int minDepth, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData ) throws IOException { super(name, factories, context, parent, pipelineAggregators, metaData); this.valuesSource = valuesSource; this.separator = separator; this.minDocCount = minDocCount; bucketOrds = new BytesRefHash(1, context.bigArrays()); this.order = InternalOrder.validate(order, this); this.bucketCountThresholds = bucketCountThresholds; this.minDepth = minDepth; }
Example 4
Source File: GeoShapeAggregator.java From elasticsearch-plugin-geoshape with MIT License | 6 votes |
public GeoShapeAggregator( String name, AggregatorFactories factories, SearchContext context, ValuesSource valuesSource, InternalGeoShape.OutputFormat output_format, boolean must_simplify, int zoom, GeoShape.Algorithm algorithm, BucketCountThresholds bucketCountThresholds, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData ) throws IOException { super(name, factories, context, parent, pipelineAggregators, metaData); this.valuesSource = valuesSource; this.output_format = output_format; this.must_simplify = must_simplify; this.zoom = zoom; this.algorithm = algorithm; bucketOrds = new BytesRefHash(1, context.bigArrays()); this.bucketCountThresholds = bucketCountThresholds; this.wkbReader = new WKBReader(); this.geometryFactory = new GeometryFactory(); }
Example 5
Source File: ChildrenQuery.java From Elasticsearch with Apache License 2.0 | 5 votes |
protected ParentCollector(IndexParentChildFieldData globalIfd, SearchContext searchContext, String parentType) { this.globalIfd = globalIfd; this.searchContext = searchContext; this.bigArrays = searchContext.bigArrays(); this.parentIdxs = new LongHash(512, bigArrays); this.parentType = parentType; }
Example 6
Source File: ParentQuery.java From Elasticsearch with Apache License 2.0 | 5 votes |
ParentOrdAndScoreCollector(SearchContext searchContext, IndexParentChildFieldData globalIfd, String parentType) { this.bigArrays = searchContext.bigArrays(); this.parentIdxs = new LongHash(512, bigArrays); this.scores = bigArrays.newFloatArray(512, false); this.globalIfd = globalIfd; this.parentType = parentType; }
Example 7
Source File: GeoPointClusteringAggregator.java From elasticsearch-aggregation-geoclustering with Apache License 2.0 | 5 votes |
GeoPointClusteringAggregator( String name, AggregatorFactories factories, ValuesSource.GeoPoint valuesSource, int precision, double radius, double ratio, int requiredSize, int shardSize, SearchContext aggregationContext, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData ) throws IOException { super(name, factories, aggregationContext, parent, pipelineAggregators, metaData); this.valuesSource = valuesSource; this.precision = precision; this.radius = radius; this.ratio = ratio; this.requiredSize = requiredSize; this.shardSize = shardSize; bucketOrds = new LongHash(1, aggregationContext.bigArrays()); centroids = context.bigArrays().newObjectArray(1); }