Remove readOptionalQuery
Replace it with readOptionalNamedWriteable
This commit is contained in:
parent
68b4371bd9
commit
8cffe0fc28
|
@ -729,6 +729,16 @@ public abstract class StreamInput extends InputStream {
|
|||
throw new UnsupportedOperationException("can't read named writeable from StreamInput");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an optional {@link QueryBuilder}.
|
||||
*/
|
||||
public <C extends NamedWriteable<?>> C readOptionalNamedWriteable(Class<C> categoryClass) throws IOException {
|
||||
if (readBoolean()) {
|
||||
return readNamedWriteable(categoryClass);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a {@link AggregatorBuilder} from the current stream
|
||||
*/
|
||||
|
@ -750,16 +760,6 @@ public abstract class StreamInput extends InputStream {
|
|||
return readNamedWriteable(QueryBuilder.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an optional {@link QueryBuilder}.
|
||||
*/
|
||||
public QueryBuilder<?> readOptionalQuery() throws IOException {
|
||||
if (readBoolean()) {
|
||||
return readNamedWriteable(QueryBuilder.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a {@link ShapeBuilder} from the current stream
|
||||
*/
|
||||
|
|
|
@ -101,7 +101,7 @@ public class FieldSortBuilder extends SortBuilder<FieldSortBuilder> {
|
|||
*/
|
||||
public FieldSortBuilder(StreamInput in) throws IOException {
|
||||
fieldName = in.readString();
|
||||
nestedFilter = in.readOptionalQuery();
|
||||
nestedFilter = in.readOptionalNamedWriteable(QueryBuilder.class);
|
||||
nestedPath = in.readOptionalString();
|
||||
missing = in.readGenericValue();
|
||||
order = in.readOptionalWriteable(SortOrder::readFromStream);
|
||||
|
|
|
@ -159,7 +159,7 @@ public class GeoDistanceSortBuilder extends SortBuilder<GeoDistanceSortBuilder>
|
|||
unit = DistanceUnit.readFromStream(in);
|
||||
order = SortOrder.readFromStream(in);
|
||||
sortMode = in.readOptionalWriteable(SortMode::readFromStream);
|
||||
nestedFilter = in.readOptionalQuery();
|
||||
nestedFilter = in.readOptionalNamedWriteable(QueryBuilder.class);
|
||||
nestedPath = in.readOptionalString();
|
||||
coerce = in.readBoolean();
|
||||
ignoreMalformed =in.readBoolean();
|
||||
|
|
|
@ -118,7 +118,7 @@ public class ScriptSortBuilder extends SortBuilder<ScriptSortBuilder> {
|
|||
order = SortOrder.readFromStream(in);
|
||||
sortMode = in.readOptionalWriteable(SortMode::readFromStream);
|
||||
nestedPath = in.readOptionalString();
|
||||
nestedFilter = in.readOptionalQuery();
|
||||
nestedFilter = in.readOptionalNamedWriteable(QueryBuilder.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue