Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate additional search request related structures #1438

Merged
merged 2 commits into from
Feb 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -588,4 +588,8 @@ After:
### GeoShapeFieldQuery renamed to GeoShapeQueryField
- The `GeoShapeFieldQuery` class has been renamed to `GeoShapeQueryField`, this affects:
- `GeoShapeQuery`'s `shape` field.
- The `shape` property is now of type `GeoShape` instead of `JsonData`.
- The `shape` property is now of type `GeoShape` instead of `JsonData`.

### RescoreQuery
- The `queryWeight` and `rescoreQueryWeight` properties have been corrected to be of type `Float` instead of `Double`.
- The `query` property has been renamed to `rescoreQuery` to match the JSON property naming.
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,26 @@
* GitHub history for details.
*/

//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------

package org.opensearch.client.opensearch._types;

import javax.annotation.Generated;
import org.opensearch.client.json.JsonEnum;
import org.opensearch.client.json.JsonpDeserializable;

// typedef: _types.SuggestMode

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public enum SuggestMode implements JsonEnum {
Missing("missing"),

Popular("popular"),

Always("always"),

;
Missing("missing"),

Popular("popular");

private final String jsonValue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,17 @@
* GitHub history for details.
*/

//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------

package org.opensearch.client.opensearch.core.search;

import jakarta.json.stream.JsonGenerator;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
Expand All @@ -42,13 +49,17 @@
import org.opensearch.client.json.ObjectDeserializer;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.util.ApiTypeHelper;
import org.opensearch.client.util.CopyableBuilder;
import org.opensearch.client.util.ObjectBuilder;
import org.opensearch.client.util.ObjectBuilderBase;
import org.opensearch.client.util.ToCopyableBuilder;

// typedef: _global.search._types.AggregationBreakdown
// typedef: core.search.AggregationBreakdown

@JsonpDeserializable
public class AggregationBreakdown implements PlainJsonSerializable {
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class AggregationBreakdown implements PlainJsonSerializable, ToCopyableBuilder<AggregationBreakdown.Builder, AggregationBreakdown> {

private final long buildAggregation;

private final long buildAggregationCount;
Expand Down Expand Up @@ -78,7 +89,6 @@ public class AggregationBreakdown implements PlainJsonSerializable {
// ---------------------------------------------------------------------------------------------

private AggregationBreakdown(Builder builder) {

this.buildAggregation = ApiTypeHelper.requireNonNull(builder.buildAggregation, this, "buildAggregation");
this.buildAggregationCount = ApiTypeHelper.requireNonNull(builder.buildAggregationCount, this, "buildAggregationCount");
this.buildLeafCollector = ApiTypeHelper.requireNonNull(builder.buildLeafCollector, this, "buildLeafCollector");
Expand All @@ -91,10 +101,9 @@ private AggregationBreakdown(Builder builder) {
this.postCollectionCount = builder.postCollectionCount;
this.reduce = ApiTypeHelper.requireNonNull(builder.reduce, this, "reduce");
this.reduceCount = ApiTypeHelper.requireNonNull(builder.reduceCount, this, "reduceCount");

}

public static AggregationBreakdown of(Function<Builder, ObjectBuilder<AggregationBreakdown>> fn) {
public static AggregationBreakdown of(Function<AggregationBreakdown.Builder, ObjectBuilder<AggregationBreakdown>> fn) {
return fn.apply(new Builder()).build();
}

Expand Down Expand Up @@ -187,14 +196,14 @@ public final long reduceCount() {
/**
* Serialize this object to JSON.
*/
@Override
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
generator.writeStartObject();
serializeInternal(generator, mapper);
generator.writeEnd();
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.writeKey("build_aggregation");
generator.write(this.buildAggregation);

Expand Down Expand Up @@ -222,57 +231,94 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
if (this.postCollection != null) {
generator.writeKey("post_collection");
generator.write(this.postCollection);

}

if (this.postCollectionCount != null) {
generator.writeKey("post_collection_count");
generator.write(this.postCollectionCount);

}

generator.writeKey("reduce");
generator.write(this.reduce);

generator.writeKey("reduce_count");
generator.write(this.reduceCount);

}

// ---------------------------------------------------------------------------------------------

@Override
@Nonnull
public Builder toBuilder() {
return new Builder(this);
}

@Nonnull
public static Builder builder() {
return new Builder();
}

/**
* Builder for {@link AggregationBreakdown}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<AggregationBreakdown> {
public static class Builder extends ObjectBuilderBase implements CopyableBuilder<Builder, AggregationBreakdown> {
private Long buildAggregation;

private Long buildAggregationCount;

private Long buildLeafCollector;

private Long buildLeafCollectorCount;

private Long collect;

private Long collectCount;

private Long initialize;

private Long initializeCount;

@Nullable
private Long postCollection;

@Nullable
private Long postCollectionCount;

private Long reduce;

private Long reduceCount;

public Builder() {}

private Builder(AggregationBreakdown o) {
this.buildAggregation = o.buildAggregation;
this.buildAggregationCount = o.buildAggregationCount;
this.buildLeafCollector = o.buildLeafCollector;
this.buildLeafCollectorCount = o.buildLeafCollectorCount;
this.collect = o.collect;
this.collectCount = o.collectCount;
this.initialize = o.initialize;
this.initializeCount = o.initializeCount;
this.postCollection = o.postCollection;
this.postCollectionCount = o.postCollectionCount;
this.reduce = o.reduce;
this.reduceCount = o.reduceCount;
}

private Builder(Builder o) {
this.buildAggregation = o.buildAggregation;
this.buildAggregationCount = o.buildAggregationCount;
this.buildLeafCollector = o.buildLeafCollector;
this.buildLeafCollectorCount = o.buildLeafCollectorCount;
this.collect = o.collect;
this.collectCount = o.collectCount;
this.initialize = o.initialize;
this.initializeCount = o.initializeCount;
this.postCollection = o.postCollection;
this.postCollectionCount = o.postCollectionCount;
this.reduce = o.reduce;
this.reduceCount = o.reduceCount;
}

@Override
@Nonnull
public Builder copy() {
return new Builder(this);
}

/**
* Required - API name: {@code build_aggregation}
*/
@Nonnull
public final Builder buildAggregation(long value) {
this.buildAggregation = value;
return this;
Expand All @@ -281,6 +327,7 @@ public final Builder buildAggregation(long value) {
/**
* Required - API name: {@code build_aggregation_count}
*/
@Nonnull
public final Builder buildAggregationCount(long value) {
this.buildAggregationCount = value;
return this;
Expand All @@ -289,6 +336,7 @@ public final Builder buildAggregationCount(long value) {
/**
* Required - API name: {@code build_leaf_collector}
*/
@Nonnull
public final Builder buildLeafCollector(long value) {
this.buildLeafCollector = value;
return this;
Expand All @@ -297,6 +345,7 @@ public final Builder buildLeafCollector(long value) {
/**
* Required - API name: {@code build_leaf_collector_count}
*/
@Nonnull
public final Builder buildLeafCollectorCount(long value) {
this.buildLeafCollectorCount = value;
return this;
Expand All @@ -305,6 +354,7 @@ public final Builder buildLeafCollectorCount(long value) {
/**
* Required - API name: {@code collect}
*/
@Nonnull
public final Builder collect(long value) {
this.collect = value;
return this;
Expand All @@ -313,6 +363,7 @@ public final Builder collect(long value) {
/**
* Required - API name: {@code collect_count}
*/
@Nonnull
public final Builder collectCount(long value) {
this.collectCount = value;
return this;
Expand All @@ -321,6 +372,7 @@ public final Builder collectCount(long value) {
/**
* Required - API name: {@code initialize}
*/
@Nonnull
public final Builder initialize(long value) {
this.initialize = value;
return this;
Expand All @@ -329,6 +381,7 @@ public final Builder initialize(long value) {
/**
* Required - API name: {@code initialize_count}
*/
@Nonnull
public final Builder initializeCount(long value) {
this.initializeCount = value;
return this;
Expand All @@ -337,6 +390,7 @@ public final Builder initializeCount(long value) {
/**
* API name: {@code post_collection}
*/
@Nonnull
public final Builder postCollection(@Nullable Long value) {
this.postCollection = value;
return this;
Expand All @@ -345,6 +399,7 @@ public final Builder postCollection(@Nullable Long value) {
/**
* API name: {@code post_collection_count}
*/
@Nonnull
public final Builder postCollectionCount(@Nullable Long value) {
this.postCollectionCount = value;
return this;
Expand All @@ -353,6 +408,7 @@ public final Builder postCollectionCount(@Nullable Long value) {
/**
* Required - API name: {@code reduce}
*/
@Nonnull
public final Builder reduce(long value) {
this.reduce = value;
return this;
Expand All @@ -361,6 +417,7 @@ public final Builder reduce(long value) {
/**
* Required - API name: {@code reduce_count}
*/
@Nonnull
public final Builder reduceCount(long value) {
this.reduceCount = value;
return this;
Expand All @@ -369,9 +426,10 @@ public final Builder reduceCount(long value) {
/**
* Builds a {@link AggregationBreakdown}.
*
* @throws NullPointerException
* if some of the required fields are null.
* @throws NullPointerException if some of the required fields are null.
*/
@Override
@Nonnull
public AggregationBreakdown build() {
_checkSingleUse();

Expand All @@ -390,7 +448,6 @@ public AggregationBreakdown build() {
);

protected static void setupAggregationBreakdownDeserializer(ObjectDeserializer<AggregationBreakdown.Builder> op) {

op.add(Builder::buildAggregation, JsonpDeserializer.longDeserializer(), "build_aggregation");
op.add(Builder::buildAggregationCount, JsonpDeserializer.longDeserializer(), "build_aggregation_count");
op.add(Builder::buildLeafCollector, JsonpDeserializer.longDeserializer(), "build_leaf_collector");
Expand All @@ -403,7 +460,42 @@ protected static void setupAggregationBreakdownDeserializer(ObjectDeserializer<A
op.add(Builder::postCollectionCount, JsonpDeserializer.longDeserializer(), "post_collection_count");
op.add(Builder::reduce, JsonpDeserializer.longDeserializer(), "reduce");
op.add(Builder::reduceCount, JsonpDeserializer.longDeserializer(), "reduce_count");
}

@Override
public int hashCode() {
int result = 17;
result = 31 * result + Long.hashCode(this.buildAggregation);
result = 31 * result + Long.hashCode(this.buildAggregationCount);
result = 31 * result + Long.hashCode(this.buildLeafCollector);
result = 31 * result + Long.hashCode(this.buildLeafCollectorCount);
result = 31 * result + Long.hashCode(this.collect);
result = 31 * result + Long.hashCode(this.collectCount);
result = 31 * result + Long.hashCode(this.initialize);
result = 31 * result + Long.hashCode(this.initializeCount);
result = 31 * result + Objects.hashCode(this.postCollection);
result = 31 * result + Objects.hashCode(this.postCollectionCount);
result = 31 * result + Long.hashCode(this.reduce);
result = 31 * result + Long.hashCode(this.reduceCount);
return result;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || this.getClass() != o.getClass()) return false;
AggregationBreakdown other = (AggregationBreakdown) o;
return this.buildAggregation == other.buildAggregation
&& this.buildAggregationCount == other.buildAggregationCount
&& this.buildLeafCollector == other.buildLeafCollector
&& this.buildLeafCollectorCount == other.buildLeafCollectorCount
&& this.collect == other.collect
&& this.collectCount == other.collectCount
&& this.initialize == other.initialize
&& this.initializeCount == other.initializeCount
&& Objects.equals(this.postCollection, other.postCollection)
&& Objects.equals(this.postCollectionCount, other.postCollectionCount)
&& this.reduce == other.reduce
&& this.reduceCount == other.reduceCount;
}
}
Loading
Loading