[Javadocs] add to o.o.search.aggs, builder, and collapse packages (#3254)
Adds class level javadocs to org.opensearch.search.aggregations, builder, and collapse packages. Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
This commit is contained in:
parent
7779078e15
commit
625623f932
|
@ -43,6 +43,8 @@ import java.util.Objects;
|
|||
|
||||
/**
|
||||
* Base implementation of a {@link AggregationBuilder}.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class AbstractAggregationBuilder<AB extends AbstractAggregationBuilder<AB>> extends AggregationBuilder {
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* An aggregation. Extends {@link ToXContent} as it makes it easier to print out its content.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface Aggregation extends ToXContentFragment {
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* A factory that knows how to create an {@link Aggregator} of a specific type.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class AggregationBuilder
|
||||
implements
|
||||
|
|
|
@ -109,6 +109,8 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* Utility class to create aggregations.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class AggregationBuilders {
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ import java.io.IOException;
|
|||
|
||||
/**
|
||||
* Thrown when failing to execute an aggregation
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class AggregationExecutionException extends OpenSearchException {
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ import java.io.IOException;
|
|||
|
||||
/**
|
||||
* Thrown when failing to execute an aggregation
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class AggregationInitializationException extends OpenSearchException {
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* Aggregation phase of a search request, used to collect aggregations
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class AggregationPhase {
|
||||
|
||||
|
|
|
@ -53,6 +53,8 @@ import static org.opensearch.common.xcontent.XContentParserUtils.parseTypedKeysO
|
|||
|
||||
/**
|
||||
* Represents a set of {@link Aggregation}s
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class Aggregations implements Iterable<Aggregation>, ToXContentFragment {
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ import java.util.function.BiConsumer;
|
|||
* <p>
|
||||
* Be <strong>careful</strong> when adding methods to this class. If possible
|
||||
* make sure they have sensible default implementations.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class Aggregator extends BucketCollector implements Releasable {
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@ import java.util.function.Function;
|
|||
|
||||
/**
|
||||
* Base implementation for concrete aggregators.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class AggregatorBase extends Aggregator {
|
||||
|
||||
|
|
|
@ -77,6 +77,8 @@ import static java.util.stream.Collectors.toMap;
|
|||
|
||||
/**
|
||||
* An immutable collection of {@link AggregatorFactories}.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class AggregatorFactories {
|
||||
public static final Pattern VALID_AGG_NAME = Pattern.compile("[^\\[\\]>]+");
|
||||
|
|
|
@ -40,6 +40,11 @@ import java.util.Map;
|
|||
|
||||
import static org.opensearch.search.aggregations.support.AggregationUsageService.OTHER_SUBTYPE;
|
||||
|
||||
/**
|
||||
* Base factory to instantiate an internal aggregator
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class AggregatorFactory {
|
||||
protected final String name;
|
||||
protected final AggregatorFactory parent;
|
||||
|
|
|
@ -40,6 +40,8 @@ import java.util.Map;
|
|||
/**
|
||||
* Interface shared by {@link AggregationBuilder} and {@link PipelineAggregationBuilder} so they can conveniently share the same namespace
|
||||
* for {@link XContentParser#namedObject(Class, String, Object)}.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface BaseAggregationBuilder {
|
||||
/**
|
||||
|
|
|
@ -40,6 +40,8 @@ import java.io.IOException;
|
|||
|
||||
/**
|
||||
* A Collector that can collect data in separate buckets.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class BucketCollector implements Collector {
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@ import java.util.function.ToLongFunction;
|
|||
* "complete" buckets using {@link #comparator()} or against a combination
|
||||
* of the buckets internals with its ordinal with
|
||||
* {@link #partiallyBuiltBucketComparator(ToLongFunction, Aggregator)}.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class BucketOrder implements ToXContentObject, Writeable {
|
||||
/**
|
||||
|
|
|
@ -41,6 +41,8 @@ import java.util.function.IntFunction;
|
|||
/**
|
||||
* Upper bound of how many {@code owningBucketOrds} that an {@link Aggregator}
|
||||
* will have to collect into.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class CardinalityUpperBound {
|
||||
/**
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
|
||||
package org.opensearch.search.aggregations;
|
||||
|
||||
/**
|
||||
* Base interface for buckets that have sub aggs
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface HasAggregations {
|
||||
|
||||
Aggregations getAggregations();
|
||||
|
|
|
@ -58,6 +58,8 @@ import static java.util.Objects.requireNonNull;
|
|||
|
||||
/**
|
||||
* An internal implementation of {@link Aggregation}. Serves as a base class for all aggregation implementations.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class InternalAggregation implements Aggregation, NamedWriteable {
|
||||
/**
|
||||
|
|
|
@ -59,6 +59,8 @@ import static java.util.stream.Collectors.toList;
|
|||
|
||||
/**
|
||||
* An internal implementation of {@link Aggregations}.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public final class InternalAggregations extends Aggregations implements Writeable {
|
||||
|
||||
|
|
|
@ -45,6 +45,11 @@ import java.util.Map;
|
|||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* Base class for internal aggregations that are comprised of multiple buckets
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class InternalMultiBucketAggregation<
|
||||
A extends InternalMultiBucketAggregation,
|
||||
B extends InternalMultiBucketAggregation.InternalBucket> extends InternalAggregation implements MultiBucketsAggregation {
|
||||
|
|
|
@ -58,6 +58,8 @@ import static java.util.stream.Collectors.toList;
|
|||
|
||||
/**
|
||||
* Implementations for {@link Bucket} ordering strategies.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class InternalOrder extends BucketOrder {
|
||||
// TODO merge the contents of this file into BucketOrder. The way it is now is relic.
|
||||
|
|
|
@ -37,6 +37,11 @@ import org.opensearch.common.io.stream.StreamInput;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Error thrown when an invalid agg is called
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class InvalidAggregationPathException extends OpenSearchException {
|
||||
|
||||
public InvalidAggregationPathException(String msg) {
|
||||
|
|
|
@ -39,6 +39,8 @@ import org.opensearch.search.aggregations.bucket.MultiBucketsAggregation.Bucket;
|
|||
*
|
||||
* @param <T> {@link Bucket} of the same type that also implements {@link KeyComparable}.
|
||||
* @see BucketOrder#key(boolean)
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface KeyComparable<T extends Bucket & KeyComparable<T>> {
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ import java.util.stream.StreamSupport;
|
|||
|
||||
/**
|
||||
* Per-leaf bucket collector.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class LeafBucketCollector implements LeafCollector {
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ import java.io.IOException;
|
|||
* A {@link LeafBucketCollector} that delegates all calls to the sub leaf
|
||||
* aggregator and sets the scorer on its source of values if it implements
|
||||
* {@link ScorerAware}.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class LeafBucketCollectorBase extends LeafBucketCollector {
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ import java.util.List;
|
|||
* {@link BucketCollector}s. It is similar to the {@link MultiCollector} except that the
|
||||
* {@link #wrap} method filters out the {@link BucketCollector#NO_OP_COLLECTOR}s and not
|
||||
* the null ones.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class MultiBucketCollector extends BucketCollector {
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@ import java.util.function.IntConsumer;
|
|||
* The consumer is used by {@link BucketsAggregator} and {@link InternalMultiBucketAggregation} to limit the number of buckets created
|
||||
* in {@link Aggregator#buildAggregations} and {@link InternalAggregation#reduce}.
|
||||
* The limit can be set by changing the `search.max_buckets` cluster setting and defaults to 65535.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class MultiBucketConsumerService {
|
||||
public static final int DEFAULT_MAX_BUCKETS = 65535;
|
||||
|
|
|
@ -41,6 +41,8 @@ import java.util.Map;
|
|||
/**
|
||||
* An aggregator that is not collected, this can typically be used when running an aggregation over a field that doesn't have
|
||||
* a mapping.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class NonCollectingAggregator extends AggregatorBase {
|
||||
/**
|
||||
|
|
|
@ -46,6 +46,8 @@ import java.util.Map;
|
|||
/**
|
||||
* An implementation of {@link Aggregation} that is parsed from a REST response.
|
||||
* Serves as a base class for all aggregation implementations that are parsed from REST.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class ParsedAggregation implements Aggregation, ToXContentFragment {
|
||||
|
||||
|
|
|
@ -47,6 +47,11 @@ import java.util.function.Supplier;
|
|||
|
||||
import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken;
|
||||
|
||||
/**
|
||||
* A multi-bucket agg that has been parsed
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class ParsedMultiBucketAggregation<B extends ParsedMultiBucketAggregation.Bucket> extends ParsedAggregation
|
||||
implements
|
||||
MultiBucketsAggregation {
|
||||
|
|
|
@ -52,6 +52,8 @@ import java.util.Objects;
|
|||
/**
|
||||
* A factory that knows how to create an {@link PipelineAggregator} of a
|
||||
* specific type.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class PipelineAggregationBuilder
|
||||
implements
|
||||
|
|
|
@ -53,6 +53,11 @@ import org.opensearch.search.sort.FieldSortBuilder;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Builder utility class for pipeline aggs
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public final class PipelineAggregatorBuilders {
|
||||
|
||||
private PipelineAggregatorBuilders() {}
|
||||
|
|
|
@ -35,6 +35,8 @@ import static org.opensearch.search.aggregations.MultiBucketConsumerService.Mult
|
|||
|
||||
/**
|
||||
* The aggregation context that is part of the search context.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class SearchContextAggregations {
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@ import java.util.Objects;
|
|||
* matches and then is able to replay a given subset of buckets which represent
|
||||
* the survivors from a pruning process performed by the aggregator that owns
|
||||
* this collector.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class BestBucketsDeferringCollector extends DeferringBucketCollector {
|
||||
static class Entry {
|
||||
|
|
|
@ -33,6 +33,8 @@ package org.opensearch.search.aggregations.bucket;
|
|||
|
||||
/**
|
||||
* Helper functions for common Bucketing functions
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public final class BucketUtils {
|
||||
|
||||
|
|
|
@ -61,6 +61,11 @@ import java.util.function.IntConsumer;
|
|||
import java.util.function.LongUnaryOperator;
|
||||
import java.util.function.ToLongFunction;
|
||||
|
||||
/**
|
||||
* Base class to collect all docs into buckets
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class BucketsAggregator extends AggregatorBase {
|
||||
|
||||
private final BigArrays bigArrays;
|
||||
|
|
|
@ -45,6 +45,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
* Aggregator that defers collecting docs based on some metric
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class DeferableBucketAggregator extends BucketsAggregator {
|
||||
/**
|
||||
* Wrapper that records collections. Non-null if any aggregations have
|
||||
|
|
|
@ -48,6 +48,8 @@ import java.util.Iterator;
|
|||
/**
|
||||
* A {@link BucketCollector} that records collected doc IDs and buckets and
|
||||
* allows to replay a subset of the collected buckets.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class DeferringBucketCollector extends BucketCollector {
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ import java.util.function.Function;
|
|||
|
||||
/**
|
||||
* A base class for all the single bucket aggregations.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class InternalSingleBucketAggregation extends InternalAggregation implements SingleBucketAggregation {
|
||||
|
||||
|
|
|
@ -36,6 +36,11 @@ import org.opensearch.search.aggregations.InternalMultiBucketAggregation;
|
|||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Utility class for keeping track of a current item in an iterator
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class IteratorAndCurrent<B extends InternalMultiBucketAggregation.InternalBucket> implements Iterator<B> {
|
||||
private final Iterator<B> iterator;
|
||||
private B current;
|
||||
|
|
|
@ -45,6 +45,8 @@ import java.util.function.LongUnaryOperator;
|
|||
* matches and then is able to replay a given subset of buckets. Exposes
|
||||
* mergeBuckets, which can be invoked by the aggregator when increasing the
|
||||
* rounding interval.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class MergingBucketsDeferringCollector extends BestBucketsDeferringCollector {
|
||||
public MergingBucketsDeferringCollector(SearchContext context, boolean isGlobal) {
|
||||
|
|
|
@ -41,6 +41,8 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* An aggregation that returns multiple buckets
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface MultiBucketsAggregation extends Aggregation {
|
||||
/**
|
||||
|
|
|
@ -47,6 +47,8 @@ import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedT
|
|||
|
||||
/**
|
||||
* A base class for all the single bucket aggregations.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class ParsedSingleBucketAggregation extends ParsedAggregation implements SingleBucketAggregation {
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ import org.opensearch.search.aggregations.HasAggregations;
|
|||
|
||||
/**
|
||||
* A single bucket aggregation
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface SingleBucketAggregation extends Aggregation, HasAggregations {
|
||||
|
||||
|
|
|
@ -33,5 +33,7 @@ package org.opensearch.search.aggregations.bucket;
|
|||
|
||||
/**
|
||||
* A bucket aggregator that doesn't create new buckets.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface SingleBucketAggregator {}
|
||||
|
|
|
@ -40,6 +40,8 @@ import java.util.List;
|
|||
* A multi bucket aggregation where the buckets are defined by a set of filters
|
||||
* (a bucket is produced per filter plus a bucket for each non-empty filter
|
||||
* intersection so A, B and A&B).
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface AdjacencyMatrix extends MultiBucketsAggregation {
|
||||
|
||||
|
|
|
@ -59,6 +59,11 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Aggregation Builder for adjacency_matrix agg
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class AdjacencyMatrixAggregationBuilder extends AbstractAggregationBuilder<AdjacencyMatrixAggregationBuilder> {
|
||||
public static final String NAME = "adjacency_matrix";
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ import static org.opensearch.index.query.AbstractQueryBuilder.parseInnerQueryBui
|
|||
/**
|
||||
* Aggregation for adjacency matrices.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class AdjacencyMatrixAggregator extends BucketsAggregator {
|
||||
|
||||
|
|
|
@ -48,6 +48,11 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Aggregation Factory for adjacency_matrix agg
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class AdjacencyMatrixAggregatorFactory extends AggregatorFactory {
|
||||
|
||||
private final String[] keys;
|
||||
|
|
|
@ -48,6 +48,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Internal class used to represent an adjacency matrix as a collection of buckets
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class InternalAdjacencyMatrix extends InternalMultiBucketAggregation<InternalAdjacencyMatrix, InternalAdjacencyMatrix.InternalBucket>
|
||||
implements
|
||||
AdjacencyMatrix {
|
||||
|
|
|
@ -41,6 +41,11 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Internal class used to hold a parsed adjacency matrix as a collection of buckets
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ParsedAdjacencyMatrix extends ParsedMultiBucketAggregation<ParsedAdjacencyMatrix.ParsedBucket> implements AdjacencyMatrix {
|
||||
|
||||
private Map<String, ParsedBucket> bucketMap;
|
||||
|
|
|
@ -55,6 +55,8 @@ import java.util.function.LongConsumer;
|
|||
|
||||
/**
|
||||
* A {@link SingleDimensionValuesSource} for binary source ({@link BytesRef}).
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
class BinaryValuesSource extends SingleDimensionValuesSource<BytesRef> {
|
||||
private final LongConsumer breakerConsumer;
|
||||
|
|
|
@ -39,6 +39,11 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Aggregation creates a composite of multiple aggs
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface CompositeAggregation extends MultiBucketsAggregation {
|
||||
interface Bucket extends MultiBucketsAggregation.Bucket {
|
||||
Map<String, Object> getKey();
|
||||
|
|
|
@ -55,6 +55,11 @@ import java.util.Set;
|
|||
|
||||
import static org.opensearch.common.xcontent.ConstructingObjectParser.constructorArg;
|
||||
|
||||
/**
|
||||
* Aggregation Builder for composite agg
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class CompositeAggregationBuilder extends AbstractAggregationBuilder<CompositeAggregationBuilder> {
|
||||
public static final String NAME = "composite";
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@ import org.opensearch.search.internal.SearchContext;
|
|||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Aggregation Factory for composite agg
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
class CompositeAggregationFactory extends AggregatorFactory {
|
||||
private final int size;
|
||||
private final CompositeValuesSourceConfig[] sources;
|
||||
|
|
|
@ -86,6 +86,11 @@ import java.util.stream.Collectors;
|
|||
|
||||
import static org.opensearch.search.aggregations.MultiBucketConsumerService.MAX_BUCKET_SETTING;
|
||||
|
||||
/**
|
||||
* Main aggregator that aggregates docs from mulitple aggregations
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
final class CompositeAggregator extends BucketsAggregator {
|
||||
private final int size;
|
||||
private final List<String> sourceNames;
|
||||
|
|
|
@ -41,6 +41,8 @@ import java.util.Arrays;
|
|||
|
||||
/**
|
||||
* A key that is composed of multiple {@link Comparable} values.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
class CompositeKey implements Writeable {
|
||||
private final Comparable[] values;
|
||||
|
|
|
@ -47,6 +47,8 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* A specialized {@link PriorityQueue} implementation for composite buckets.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
final class CompositeValuesCollectorQueue extends PriorityQueue<Integer> implements Releasable {
|
||||
private class Slot {
|
||||
|
|
|
@ -55,6 +55,8 @@ import static org.opensearch.search.aggregations.bucket.missing.MissingOrder.fro
|
|||
|
||||
/**
|
||||
* A {@link ValuesSource} builder for {@link CompositeAggregationBuilder}
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class CompositeValuesSourceBuilder<AB extends CompositeValuesSourceBuilder<AB>> implements Writeable, ToXContentFragment {
|
||||
|
||||
|
|
|
@ -43,6 +43,11 @@ import org.opensearch.search.sort.SortOrder;
|
|||
|
||||
import java.util.function.LongConsumer;
|
||||
|
||||
/**
|
||||
* Field configuration class for composite values
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class CompositeValuesSourceConfig {
|
||||
|
||||
@FunctionalInterface
|
||||
|
|
|
@ -50,6 +50,11 @@ import java.io.IOException;
|
|||
|
||||
import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken;
|
||||
|
||||
/**
|
||||
* Helper class for obtaining values source parsers for different aggs
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class CompositeValuesSourceParserHelper {
|
||||
|
||||
static <VB extends CompositeValuesSourceBuilder<VB>, T> void declareValuesSourceFields(AbstractObjectParser<VB, T> objectParser) {
|
||||
|
|
|
@ -69,6 +69,8 @@ import java.util.function.LongConsumer;
|
|||
/**
|
||||
* A {@link CompositeValuesSourceBuilder} that builds a {@link RoundingValuesSource} from a {@link Script} or
|
||||
* a field name using the provided interval.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class DateHistogramValuesSourceBuilder extends CompositeValuesSourceBuilder<DateHistogramValuesSourceBuilder>
|
||||
implements
|
||||
|
|
|
@ -50,6 +50,8 @@ import java.io.IOException;
|
|||
|
||||
/**
|
||||
* A {@link SingleDimensionValuesSource} for doubles.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
class DoubleValuesSource extends SingleDimensionValuesSource<Double> {
|
||||
private final CheckedFunction<LeafReaderContext, SortedNumericDoubleValues, IOException> docValuesFunc;
|
||||
|
|
|
@ -62,6 +62,11 @@ import java.util.Objects;
|
|||
import java.util.function.LongConsumer;
|
||||
import java.util.function.LongUnaryOperator;
|
||||
|
||||
/**
|
||||
* Builds values source for geotile_grid agg
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class GeoTileGridValuesSourceBuilder extends CompositeValuesSourceBuilder<GeoTileGridValuesSourceBuilder> {
|
||||
@FunctionalInterface
|
||||
public interface GeoTileCompositeSuppier {
|
||||
|
|
|
@ -49,6 +49,8 @@ import java.util.function.LongUnaryOperator;
|
|||
*
|
||||
* Since geotile values can be represented as long values, this class is almost the same as {@link LongValuesSource}
|
||||
* The main differences is {@link GeoTileValuesSource#setAfter(Comparable)} as it needs to accept geotile string values i.e. "zoom/x/y".
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
class GeoTileValuesSource extends LongValuesSource {
|
||||
GeoTileValuesSource(
|
||||
|
|
|
@ -54,6 +54,8 @@ import static org.apache.lucene.index.SortedSetDocValues.NO_MORE_ORDS;
|
|||
|
||||
/**
|
||||
* A {@link SingleDimensionValuesSource} for global ordinals.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
class GlobalOrdinalValuesSource extends SingleDimensionValuesSource<BytesRef> {
|
||||
private final CheckedFunction<LeafReaderContext, SortedSetDocValues, IOException> docValuesFunc;
|
||||
|
|
|
@ -40,6 +40,11 @@ import org.opensearch.search.aggregations.support.ValuesSource;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* The values source for histogram agg
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
class HistogramValuesSource extends ValuesSource.Numeric {
|
||||
private final Numeric vs;
|
||||
private final double interval;
|
||||
|
|
|
@ -57,6 +57,8 @@ import java.util.function.LongConsumer;
|
|||
/**
|
||||
* A {@link CompositeValuesSourceBuilder} that builds a {@link HistogramValuesSource} from another numeric values source
|
||||
* using the provided interval.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class HistogramValuesSourceBuilder extends CompositeValuesSourceBuilder<HistogramValuesSourceBuilder> {
|
||||
@FunctionalInterface
|
||||
|
|
|
@ -58,6 +58,11 @@ import java.util.Objects;
|
|||
import java.util.PriorityQueue;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Internal coordination class for composite aggs
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class InternalComposite extends InternalMultiBucketAggregation<InternalComposite, InternalComposite.InternalBucket>
|
||||
implements
|
||||
CompositeAggregation {
|
||||
|
|
|
@ -63,6 +63,8 @@ import java.util.function.ToLongFunction;
|
|||
|
||||
/**
|
||||
* A {@link SingleDimensionValuesSource} for longs.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
class LongValuesSource extends SingleDimensionValuesSource<Long> {
|
||||
private final BigArrays bigArrays;
|
||||
|
|
|
@ -42,6 +42,11 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A composite result parsed between nodes
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ParsedComposite extends ParsedMultiBucketAggregation<ParsedComposite.ParsedBucket> implements CompositeAggregation {
|
||||
private static final ObjectParser<ParsedComposite, Void> PARSER = new ObjectParser<>(
|
||||
ParsedComposite.class.getSimpleName(),
|
||||
|
|
|
@ -45,6 +45,8 @@ import java.util.function.ToLongFunction;
|
|||
|
||||
/**
|
||||
* A {@link SortedDocsProducer} that can sort documents based on numerics indexed in the provided field.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
class PointsSortedDocsProducer extends SortedDocsProducer {
|
||||
private final ToLongFunction<byte[]> bucketFunction;
|
||||
|
|
|
@ -44,6 +44,8 @@ import java.io.IOException;
|
|||
/**
|
||||
* A wrapper for {@link ValuesSource.Numeric} that uses {@link Rounding} to transform the long values
|
||||
* produced by the underlying source.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
class RoundingValuesSource extends ValuesSource.Numeric {
|
||||
private final ValuesSource.Numeric vs;
|
||||
|
|
|
@ -50,6 +50,8 @@ import static org.opensearch.search.aggregations.bucket.missing.MissingOrder.LAS
|
|||
|
||||
/**
|
||||
* A source that can record and compare values of similar type.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
abstract class SingleDimensionValuesSource<T extends Comparable<T>> implements Releasable {
|
||||
protected final BigArrays bigArrays;
|
||||
|
|
|
@ -47,6 +47,8 @@ import java.io.IOException;
|
|||
* A producer that visits composite buckets in the order of the value indexed in the leading source of the composite
|
||||
* definition. It can be used to control which documents should be collected to produce the top composite buckets
|
||||
* without visiting all documents in an index.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
abstract class SortedDocsProducer {
|
||||
protected final String field;
|
||||
|
|
|
@ -45,6 +45,8 @@ import java.io.IOException;
|
|||
|
||||
/**
|
||||
* A {@link SortedDocsProducer} that can sort documents based on terms indexed in the provided field.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
class TermsSortedDocsProducer extends SortedDocsProducer {
|
||||
TermsSortedDocsProducer(String field) {
|
||||
|
|
|
@ -58,6 +58,8 @@ import java.util.function.LongUnaryOperator;
|
|||
/**
|
||||
* A {@link CompositeValuesSourceBuilder} that builds a {@link ValuesSource} from a {@link Script} or
|
||||
* a field name.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class TermsValuesSourceBuilder extends CompositeValuesSourceBuilder<TermsValuesSourceBuilder> {
|
||||
|
||||
|
|
|
@ -35,5 +35,7 @@ import org.opensearch.search.aggregations.bucket.SingleBucketAggregation;
|
|||
|
||||
/**
|
||||
* A {@code filter} aggregation. Defines a single bucket that holds all documents that match a specific filter.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface Filter extends SingleBucketAggregation {}
|
||||
|
|
|
@ -51,6 +51,11 @@ import java.util.Objects;
|
|||
|
||||
import static org.opensearch.index.query.AbstractQueryBuilder.parseInnerQueryBuilder;
|
||||
|
||||
/**
|
||||
* Aggregation Builder for filter agg
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class FilterAggregationBuilder extends AbstractAggregationBuilder<FilterAggregationBuilder> {
|
||||
public static final String NAME = "filter";
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ import java.util.function.Supplier;
|
|||
|
||||
/**
|
||||
* Aggregate all docs that match a filter.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class FilterAggregator extends BucketsAggregator implements SingleBucketAggregator {
|
||||
|
||||
|
|
|
@ -48,6 +48,11 @@ import org.opensearch.search.internal.SearchContext;
|
|||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Aggregation Factory for filter agg
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class FilterAggregatorFactory extends AggregatorFactory {
|
||||
|
||||
private Weight weight;
|
||||
|
|
|
@ -39,6 +39,8 @@ import java.util.List;
|
|||
/**
|
||||
* A multi bucket aggregation where the buckets are defined by a set of filters (a bucket per filter). Each bucket
|
||||
* will collect all documents matching its filter.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface Filters extends MultiBucketsAggregation {
|
||||
|
||||
|
|
|
@ -59,6 +59,11 @@ import java.util.Objects;
|
|||
|
||||
import static org.opensearch.index.query.AbstractQueryBuilder.parseInnerQueryBuilder;
|
||||
|
||||
/**
|
||||
* Aggregation Builder for filters agg
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class FiltersAggregationBuilder extends AbstractAggregationBuilder<FiltersAggregationBuilder> {
|
||||
public static final String NAME = "filters";
|
||||
|
||||
|
|
|
@ -60,6 +60,11 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* Aggregate all docs that match multiple filters.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class FiltersAggregator extends BucketsAggregator {
|
||||
|
||||
public static final ParseField FILTERS_FIELD = new ParseField("filters");
|
||||
|
|
|
@ -49,6 +49,11 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Aggregation Factory for filters agg
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class FiltersAggregatorFactory extends AggregatorFactory {
|
||||
|
||||
private final String[] keys;
|
||||
|
|
|
@ -39,6 +39,11 @@ import org.opensearch.search.aggregations.bucket.InternalSingleBucketAggregation
|
|||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Implementation of filter agg
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class InternalFilter extends InternalSingleBucketAggregation implements Filter {
|
||||
InternalFilter(String name, long docCount, InternalAggregations subAggregations, Map<String, Object> metadata) {
|
||||
super(name, docCount, subAggregations, metadata);
|
||||
|
|
|
@ -47,6 +47,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Implementation of filters agg
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class InternalFilters extends InternalMultiBucketAggregation<InternalFilters, InternalFilters.InternalBucket> implements Filters {
|
||||
public static class InternalBucket extends InternalMultiBucketAggregation.InternalBucket implements Filters.Bucket {
|
||||
|
||||
|
|
|
@ -36,6 +36,11 @@ import org.opensearch.search.aggregations.bucket.ParsedSingleBucketAggregation;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* A filter agg result parsed between nodes
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ParsedFilter extends ParsedSingleBucketAggregation implements Filter {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -48,6 +48,11 @@ import java.util.Map;
|
|||
|
||||
import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken;
|
||||
|
||||
/**
|
||||
* A filters agg result parsed between nodes
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ParsedFilters extends ParsedMultiBucketAggregation<ParsedFilters.ParsedBucket> implements Filters {
|
||||
|
||||
private Map<String, ParsedBucket> bucketMap;
|
||||
|
|
|
@ -39,6 +39,8 @@ import org.opensearch.index.fielddata.MultiGeoPointValues;
|
|||
* according to whether they are within the specified {@link GeoBoundingBox}.
|
||||
*
|
||||
* The specified bounding box is assumed to be bounded.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
class BoundedCellValues extends CellValues {
|
||||
|
||||
|
|
|
@ -33,6 +33,11 @@ package org.opensearch.search.aggregations.bucket.geogrid;
|
|||
|
||||
import org.apache.lucene.util.PriorityQueue;
|
||||
|
||||
/**
|
||||
* Internal priority queue for computing geogrid relations
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
class BucketPriorityQueue<B extends InternalGeoGridBucket> extends PriorityQueue<B> {
|
||||
|
||||
BucketPriorityQueue(int size) {
|
||||
|
|
|
@ -42,6 +42,8 @@ import org.opensearch.search.aggregations.support.ValuesSource;
|
|||
/**
|
||||
* Wrapper class to help convert {@link MultiGeoPointValues}
|
||||
* to numeric long values for bucketing.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class CellIdSource extends ValuesSource.Numeric {
|
||||
private final ValuesSource.GeoPoint valuesSource;
|
||||
|
|
|
@ -40,6 +40,8 @@ import java.io.IOException;
|
|||
* Class representing the long-encoded grid-cells belonging to
|
||||
* the geo-doc-values. Class must encode the values and then
|
||||
* sort them in order to account for the cells correctly.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
abstract class CellValues extends AbstractSortingNumericDocValues {
|
||||
private MultiGeoPointValues geoValues;
|
||||
|
|
|
@ -38,6 +38,8 @@ import java.util.List;
|
|||
/**
|
||||
* A geo-grid aggregation. Defines multiple buckets, each representing a cell in a geo-grid of a specific
|
||||
* precision.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface GeoGrid extends MultiBucketsAggregation {
|
||||
|
||||
|
|
|
@ -57,6 +57,11 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* Base Aggregation Builder for geohash_grid and geotile_grid aggs
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class GeoGridAggregationBuilder extends ValuesSourceAggregationBuilder<GeoGridAggregationBuilder> {
|
||||
/* recognized field names in JSON */
|
||||
static final ParseField FIELD_PRECISION = new ParseField("precision");
|
||||
|
|
|
@ -54,6 +54,8 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* Aggregates data expressed as longs (for efficiency's sake) but formats results as aggregation-specific strings.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class GeoGridAggregator<T extends InternalGeoGrid> extends BucketsAggregator {
|
||||
|
||||
|
|
|
@ -48,6 +48,11 @@ import org.opensearch.search.aggregations.support.ValuesSourceRegistry;
|
|||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Aggregation Builder for geohash_grid
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class GeoHashGridAggregationBuilder extends GeoGridAggregationBuilder {
|
||||
public static final String NAME = "geohash_grid";
|
||||
public static final int DEFAULT_PRECISION = 5;
|
||||
|
|
|
@ -44,6 +44,8 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* Aggregates data expressed as GeoHash longs (for efficiency's sake) but formats results as Geohash strings.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class GeoHashGridAggregator extends GeoGridAggregator<InternalGeoHashGrid> {
|
||||
|
||||
|
|
|
@ -53,6 +53,11 @@ import java.util.Map;
|
|||
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
/**
|
||||
* Aggregation Factory for geohash_grid agg
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class GeoHashGridAggregatorFactory extends ValuesSourceAggregatorFactory {
|
||||
|
||||
private final int precision;
|
||||
|
|
|
@ -47,6 +47,11 @@ import org.opensearch.search.aggregations.support.ValuesSourceRegistry;
|
|||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Aggregation Builder for geotile_grid agg
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class GeoTileGridAggregationBuilder extends GeoGridAggregationBuilder {
|
||||
public static final String NAME = "geotile_grid";
|
||||
public static final int DEFAULT_PRECISION = 7;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue