All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.arakelian.elastic.model.aggs.bucket.DateHistogramAggregation Maven / Gradle / Ivy

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.arakelian.elastic.model.aggs.bucket;

import java.util.List;

import org.immutables.value.Value;

import com.arakelian.core.feature.Nullable;
import com.arakelian.elastic.model.aggs.Aggregation;
import com.arakelian.elastic.model.aggs.BucketAggregation;
import com.arakelian.elastic.model.aggs.ValuesSourceAggregation;
import com.arakelian.elastic.search.AggregationVisitor;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.collect.ImmutableList;

/**
 * A multi-bucket aggregation similar to @{link {@link HistogramAggregation}} except it can only be
 * applied on date values.
 *
 * 

* Since dates are represented in Elasticsearch internally as long values, it is possible to use the * normal histogram on dates as well, though accuracy will be compromised. The reason for this is in * the fact that time based intervals are not fixed (think of leap years and on the number of days * in a month). For this reason, we need special support for time based data. *

* *

* From a functionality perspective, this histogram supports the same features as the normal * histogram. The main difference is that the interval can be specified by date/time expressions. *

* * @see Date * Histogram Aggregation * @see DateHistogramAggregationBuilder.java */ @Value.Immutable(copy = false) @JsonSerialize(as = ImmutableDateHistogramAggregation.class) @JsonDeserialize(builder = ImmutableDateHistogramAggregation.Builder.class) @JsonTypeName(Aggregation.DATE_HISTOGRAM_AGGREGATION) public interface DateHistogramAggregation extends BucketAggregation, ValuesSourceAggregation { @Override default void accept(final AggregationVisitor visitor) { if (!visitor.enter(this)) { return; } try { if (visitor.enterDateHistogram(this)) { visitor.leaveDateHistogram(this); } } finally { visitor.leave(this); } } @Nullable public Long getExtendedBoundsMax(); @Nullable public Long getExtendedBoundsMin(); @Nullable public String getInterval(); /** * Returns the minimum number of hits required before returning a term. * * @return the minimum number of hits required before returning a term. */ @Nullable public Long getMinDocCount(); @Nullable public Long getOffset(); /** * Returns the bucket order. * * @return the bucket order * * @see InternalOrder.java */ @Value.Default public default List getOrder() { return ImmutableList.of(); } @Nullable public Boolean isKeyed(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy