Search in sources :

Example 1 with IntervalsQuery

use of org.opensearch.client.opensearch._types.query_dsl.IntervalsQuery in project opensearch-java by opensearch-project.

the class ClassStructureTest method testUnionInheritedFieldAssignment.

/**
 * Tests correct initialization of inherited fields for union typed.
 */
@Test
public void testUnionInheritedFieldAssignment() {
    IntervalsQuery iq = IntervalsQuery.of(_1 -> _1.boost(2.0f).field("foo").allOf(b -> b.intervals(Collections.emptyList())));
    assertAncestorCount(1, iq);
    assertEquals(2.0f, iq.boost(), 0.01);
    assertEquals("{\"foo\":{\"boost\":2.0,\"all_of\":{\"intervals\":[]}}}", toJson(iq));
}
Also used : Buckets(org.opensearch.client.opensearch._types.aggregations.Buckets) Arrays(java.util.Arrays) Aggregation(org.opensearch.client.opensearch._types.aggregations.Aggregation) GetRequest(org.opensearch.client.opensearch.core.GetRequest) HashMap(java.util.HashMap) Aggregate(org.opensearch.client.opensearch._types.aggregations.Aggregate) RangeBucket(org.opensearch.client.opensearch._types.aggregations.RangeBucket) ValueCountAggregation(org.opensearch.client.opensearch._types.aggregations.ValueCountAggregation) ObjectBuilder(org.opensearch.client.util.ObjectBuilder) TotalHitsRelation(org.opensearch.client.opensearch.core.search.TotalHitsRelation) ApiTypeHelper(org.opensearch.client.util.ApiTypeHelper) Map(java.util.Map) HitsMetadata(org.opensearch.client.opensearch.core.search.HitsMetadata) Method(java.lang.reflect.Method) Nullable(javax.annotation.Nullable) ErrorCause(org.opensearch.client.opensearch._types.ErrorCause) JsonData(org.opensearch.client.json.JsonData) Test(org.junit.Test) TotalHits(org.opensearch.client.opensearch.core.search.TotalHits) Collectors(java.util.stream.Collectors) IntervalsQuery(org.opensearch.client.opensearch._types.query_dsl.IntervalsQuery) DateRangeAggregate(org.opensearch.client.opensearch._types.aggregations.DateRangeAggregate) MissingRequiredPropertyException(org.opensearch.client.util.MissingRequiredPropertyException) List(java.util.List) SearchRequest(org.opensearch.client.opensearch.core.SearchRequest) CardinalityAggregate(org.opensearch.client.opensearch._types.aggregations.CardinalityAggregate) FieldAndFormat(org.opensearch.client.opensearch._types.query_dsl.FieldAndFormat) Collections(java.util.Collections) IntervalsQuery(org.opensearch.client.opensearch._types.query_dsl.IntervalsQuery) Test(org.junit.Test)

Aggregations

Method (java.lang.reflect.Method)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 Nullable (javax.annotation.Nullable)1 Test (org.junit.Test)1 JsonData (org.opensearch.client.json.JsonData)1 ErrorCause (org.opensearch.client.opensearch._types.ErrorCause)1 Aggregate (org.opensearch.client.opensearch._types.aggregations.Aggregate)1 Aggregation (org.opensearch.client.opensearch._types.aggregations.Aggregation)1 Buckets (org.opensearch.client.opensearch._types.aggregations.Buckets)1 CardinalityAggregate (org.opensearch.client.opensearch._types.aggregations.CardinalityAggregate)1 DateRangeAggregate (org.opensearch.client.opensearch._types.aggregations.DateRangeAggregate)1 RangeBucket (org.opensearch.client.opensearch._types.aggregations.RangeBucket)1 ValueCountAggregation (org.opensearch.client.opensearch._types.aggregations.ValueCountAggregation)1 FieldAndFormat (org.opensearch.client.opensearch._types.query_dsl.FieldAndFormat)1 IntervalsQuery (org.opensearch.client.opensearch._types.query_dsl.IntervalsQuery)1