fixes for some NORELEASE comments
This commit is contained in:
parent
8426c14a6d
commit
e15736aa97
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.ActionRequestBuilder;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
import org.elasticsearch.action.support.IndicesOptions;
|
||||||
import org.elasticsearch.client.ElasticsearchClient;
|
import org.elasticsearch.client.ElasticsearchClient;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||||
import org.elasticsearch.index.query.QueryBuilder;
|
import org.elasticsearch.index.query.QueryBuilder;
|
||||||
|
@ -41,6 +40,7 @@ import org.elasticsearch.search.sort.SortOrder;
|
||||||
import org.elasticsearch.search.suggest.SuggestBuilder;
|
import org.elasticsearch.search.suggest.SuggestBuilder;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A search action request builder.
|
* A search action request builder.
|
||||||
|
@ -241,6 +241,14 @@ public class SearchRequestBuilder extends ActionRequestBuilder<SearchRequest, Se
|
||||||
* The stats groups this request will be aggregated under.
|
* The stats groups this request will be aggregated under.
|
||||||
*/
|
*/
|
||||||
public SearchRequestBuilder setStats(String... statsGroups) {
|
public SearchRequestBuilder setStats(String... statsGroups) {
|
||||||
|
sourceBuilder().stats(Arrays.asList(statsGroups));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The stats groups this request will be aggregated under.
|
||||||
|
*/
|
||||||
|
public SearchRequestBuilder setStats(List<String> statsGroups) {
|
||||||
sourceBuilder().stats(statsGroups);
|
sourceBuilder().stats(statsGroups);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,6 @@ public class IndexQueryParserService extends AbstractIndexComponent {
|
||||||
return indicesQueriesRegistry;
|
return indicesQueriesRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
//norelease this needs to go away
|
|
||||||
public ParsedQuery parse(QueryBuilder<?> queryBuilder) {
|
public ParsedQuery parse(QueryBuilder<?> queryBuilder) {
|
||||||
QueryShardContext context = cache.get();
|
QueryShardContext context = cache.get();
|
||||||
context.reset();
|
context.reset();
|
||||||
|
|
|
@ -50,6 +50,7 @@ import org.elasticsearch.search.sort.SortOrder;
|
||||||
import org.elasticsearch.search.suggest.SuggestBuilder;
|
import org.elasticsearch.search.suggest.SuggestBuilder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static org.elasticsearch.common.unit.TimeValue.parseTimeValue;
|
import static org.elasticsearch.common.unit.TimeValue.parseTimeValue;
|
||||||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
|
@ -262,7 +263,7 @@ public class RestSearchAction extends BaseRestHandler {
|
||||||
|
|
||||||
String sStats = request.param("stats");
|
String sStats = request.param("stats");
|
||||||
if (sStats != null) {
|
if (sStats != null) {
|
||||||
searchSourceBuilder.stats(Strings.splitStringByCommaToArray(sStats));
|
searchSourceBuilder.stats(Arrays.asList(Strings.splitStringByCommaToArray(sStats)));
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,6 @@ import org.elasticsearch.search.query.ScrollQuerySearchResult;
|
||||||
import org.elasticsearch.search.warmer.IndexWarmersMetaData;
|
import org.elasticsearch.search.warmer.IndexWarmersMetaData;
|
||||||
import org.elasticsearch.threadpool.ThreadPool;
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
@ -856,7 +855,7 @@ public class SearchService extends AbstractLifecycleComponent<SearchService> {
|
||||||
if (source.scriptFields() != null) {
|
if (source.scriptFields() != null) {
|
||||||
for (org.elasticsearch.search.builder.SearchSourceBuilder.ScriptField field : source.scriptFields()) {
|
for (org.elasticsearch.search.builder.SearchSourceBuilder.ScriptField field : source.scriptFields()) {
|
||||||
SearchScript searchScript = context.scriptService().search(context.lookup(), field.script(), ScriptContext.Standard.SEARCH);
|
SearchScript searchScript = context.scriptService().search(context.lookup(), field.script(), ScriptContext.Standard.SEARCH);
|
||||||
context.scriptFields().add(new ScriptField(field.fieldName(), searchScript, false)); // NORELEASE need to have ignore_exception parsed somewhere
|
context.scriptFields().add(new ScriptField(field.fieldName(), searchScript, field.ignoreFailure()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (source.ext() != null) {
|
if (source.ext() != null) {
|
||||||
|
@ -893,7 +892,7 @@ public class SearchService extends AbstractLifecycleComponent<SearchService> {
|
||||||
context.version(source.version());
|
context.version(source.version());
|
||||||
}
|
}
|
||||||
if (source.stats() != null) {
|
if (source.stats() != null) {
|
||||||
context.groupStats(Arrays.asList(source.stats())); // NORELEASE stats should be a list in SearchSourceBuilder
|
context.groupStats(source.stats());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,6 @@ import org.elasticsearch.search.suggest.SuggestBuilder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -84,6 +83,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
public static final ParseField FIELDDATA_FIELDS_FIELD = new ParseField("fielddata_fields");
|
public static final ParseField FIELDDATA_FIELDS_FIELD = new ParseField("fielddata_fields");
|
||||||
public static final ParseField SCRIPT_FIELDS_FIELD = new ParseField("script_fields");
|
public static final ParseField SCRIPT_FIELDS_FIELD = new ParseField("script_fields");
|
||||||
public static final ParseField SCRIPT_FIELD = new ParseField("script");
|
public static final ParseField SCRIPT_FIELD = new ParseField("script");
|
||||||
|
public static final ParseField IGNORE_FAILURE_FIELD = new ParseField("ignore_failure");
|
||||||
public static final ParseField SORT_FIELD = new ParseField("sort");
|
public static final ParseField SORT_FIELD = new ParseField("sort");
|
||||||
public static final ParseField TRACK_SCORES_FIELD = new ParseField("track_scores");
|
public static final ParseField TRACK_SCORES_FIELD = new ParseField("track_scores");
|
||||||
public static final ParseField INDICES_BOOST_FIELD = new ParseField("indices_boost");
|
public static final ParseField INDICES_BOOST_FIELD = new ParseField("indices_boost");
|
||||||
|
@ -150,7 +150,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
|
|
||||||
private ObjectFloatHashMap<String> indexBoost = null;
|
private ObjectFloatHashMap<String> indexBoost = null;
|
||||||
|
|
||||||
private String[] stats;
|
private List<String> stats;
|
||||||
|
|
||||||
private BytesReference ext = null;
|
private BytesReference ext = null;
|
||||||
|
|
||||||
|
@ -630,10 +630,23 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
* The script
|
* The script
|
||||||
*/
|
*/
|
||||||
public SearchSourceBuilder scriptField(String name, Script script) {
|
public SearchSourceBuilder scriptField(String name, Script script) {
|
||||||
|
scriptField(name, script, false);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a script field under the given name with the provided script.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* The name of the field
|
||||||
|
* @param script
|
||||||
|
* The script
|
||||||
|
*/
|
||||||
|
public SearchSourceBuilder scriptField(String name, Script script, boolean ignoreFailure) {
|
||||||
if (scriptFields == null) {
|
if (scriptFields == null) {
|
||||||
scriptFields = new ArrayList<>();
|
scriptFields = new ArrayList<>();
|
||||||
}
|
}
|
||||||
scriptFields.add(new ScriptField(name, script));
|
scriptFields.add(new ScriptField(name, script, ignoreFailure));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,7 +685,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
/**
|
/**
|
||||||
* The stats groups this request will be aggregated under.
|
* The stats groups this request will be aggregated under.
|
||||||
*/
|
*/
|
||||||
public SearchSourceBuilder stats(String... statsGroups) {
|
public SearchSourceBuilder stats(List<String> statsGroups) {
|
||||||
this.stats = statsGroups;
|
this.stats = statsGroups;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -680,7 +693,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
/**
|
/**
|
||||||
* The stats groups this request will be aggregated under.
|
* The stats groups this request will be aggregated under.
|
||||||
*/
|
*/
|
||||||
public String[] stats() {
|
public List<String> stats() {
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -748,21 +761,23 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
String scriptFieldName = parser.currentName();
|
String scriptFieldName = parser.currentName();
|
||||||
token = parser.nextToken();
|
token = parser.nextToken();
|
||||||
if (token == XContentParser.Token.START_OBJECT) {
|
if (token == XContentParser.Token.START_OBJECT) {
|
||||||
|
Script script = null;
|
||||||
|
boolean ignoreFailure = false;
|
||||||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||||
if (token == XContentParser.Token.FIELD_NAME) {
|
if (token == XContentParser.Token.FIELD_NAME) {
|
||||||
currentFieldName = parser.currentName();
|
currentFieldName = parser.currentName();
|
||||||
} else if (token.isValue()) {
|
} else if (token.isValue()) {
|
||||||
if (context.parseFieldMatcher().match(currentFieldName, SCRIPT_FIELD)) {
|
if (context.parseFieldMatcher().match(currentFieldName, SCRIPT_FIELD)) {
|
||||||
scriptFields
|
script = Script.parse(parser, context.parseFieldMatcher());
|
||||||
.add(new ScriptField(scriptFieldName, Script.parse(parser, context.parseFieldMatcher())));
|
} else if (context.parseFieldMatcher().match(currentFieldName, IGNORE_FAILURE_FIELD)) {
|
||||||
|
ignoreFailure = parser.booleanValue();
|
||||||
} else {
|
} else {
|
||||||
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName
|
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName
|
||||||
+ "].", parser.getTokenLocation());
|
+ "].", parser.getTokenLocation());
|
||||||
}
|
}
|
||||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||||
if (context.parseFieldMatcher().match(currentFieldName, SCRIPT_FIELD)) {
|
if (context.parseFieldMatcher().match(currentFieldName, SCRIPT_FIELD)) {
|
||||||
scriptFields
|
script = Script.parse(parser, context.parseFieldMatcher());
|
||||||
.add(new ScriptField(scriptFieldName, Script.parse(parser, context.parseFieldMatcher())));
|
|
||||||
} else {
|
} else {
|
||||||
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName
|
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName
|
||||||
+ "].", parser.getTokenLocation());
|
+ "].", parser.getTokenLocation());
|
||||||
|
@ -772,6 +787,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
+ "].", parser.getTokenLocation());
|
+ "].", parser.getTokenLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
scriptFields.add(new ScriptField(scriptFieldName, script, ignoreFailure));
|
||||||
} else {
|
} else {
|
||||||
throw new ParsingException(parser.getTokenLocation(), "Expected [" + XContentParser.Token.START_OBJECT + "] in ["
|
throw new ParsingException(parser.getTokenLocation(), "Expected [" + XContentParser.Token.START_OBJECT + "] in ["
|
||||||
+ currentFieldName + "] but found [" + token + "]", parser.getTokenLocation());
|
+ currentFieldName + "] but found [" + token + "]", parser.getTokenLocation());
|
||||||
|
@ -879,7 +895,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
+ currentFieldName + "] but found [" + token + "]", parser.getTokenLocation());
|
+ currentFieldName + "] but found [" + token + "]", parser.getTokenLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
builder.stats = stats.toArray(new String[stats.size()]);
|
builder.stats = stats;
|
||||||
} else if (context.parseFieldMatcher().match(currentFieldName, _SOURCE_FIELD)) {
|
} else if (context.parseFieldMatcher().match(currentFieldName, _SOURCE_FIELD)) {
|
||||||
FetchSourceContext fetchSourceContext = FetchSourceContext.parse(parser, context);
|
FetchSourceContext fetchSourceContext = FetchSourceContext.parse(parser, context);
|
||||||
builder.fetchSourceContext = fetchSourceContext;
|
builder.fetchSourceContext = fetchSourceContext;
|
||||||
|
@ -966,9 +982,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
if (scriptFields != null) {
|
if (scriptFields != null) {
|
||||||
builder.startObject(SCRIPT_FIELDS_FIELD.getPreferredName());
|
builder.startObject(SCRIPT_FIELDS_FIELD.getPreferredName());
|
||||||
for (ScriptField scriptField : scriptFields) {
|
for (ScriptField scriptField : scriptFields) {
|
||||||
builder.startObject(scriptField.fieldName());
|
scriptField.toXContent(builder, params);
|
||||||
builder.field("script", scriptField.script());
|
|
||||||
builder.endObject();
|
|
||||||
}
|
}
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
}
|
}
|
||||||
|
@ -1044,7 +1058,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats != null) {
|
if (stats != null) {
|
||||||
builder.array(STATS_FIELD.getPreferredName(), stats);
|
builder.field(STATS_FIELD.getPreferredName(), stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ext != null) {
|
if (ext != null) {
|
||||||
|
@ -1059,12 +1073,18 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
|
|
||||||
public static final ScriptField PROTOTYPE = new ScriptField(null, null);
|
public static final ScriptField PROTOTYPE = new ScriptField(null, null);
|
||||||
|
|
||||||
|
private final boolean ignoreFailure;
|
||||||
private final String fieldName;
|
private final String fieldName;
|
||||||
private final Script script;
|
private final Script script;
|
||||||
|
|
||||||
private ScriptField(String fieldName, Script script) {
|
private ScriptField(String fieldName, Script script) {
|
||||||
|
this(fieldName, script, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ScriptField(String fieldName, Script script, boolean ignoreFailure) {
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
this.script = script;
|
this.script = script;
|
||||||
|
this.ignoreFailure = ignoreFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String fieldName() {
|
public String fieldName() {
|
||||||
|
@ -1075,28 +1095,34 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean ignoreFailure() {
|
||||||
|
return ignoreFailure;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScriptField readFrom(StreamInput in) throws IOException {
|
public ScriptField readFrom(StreamInput in) throws IOException {
|
||||||
return new ScriptField(in.readString(), Script.readScript(in));
|
return new ScriptField(in.readString(), Script.readScript(in), in.readBoolean());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
public void writeTo(StreamOutput out) throws IOException {
|
||||||
out.writeString(fieldName);
|
out.writeString(fieldName);
|
||||||
script.writeTo(out);
|
script.writeTo(out);
|
||||||
|
out.writeBoolean(ignoreFailure);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
builder.startObject(fieldName);
|
builder.startObject(fieldName);
|
||||||
builder.field(SCRIPT_FIELD.getPreferredName(), script);
|
builder.field(SCRIPT_FIELD.getPreferredName(), script);
|
||||||
|
builder.field(IGNORE_FAILURE_FIELD.getPreferredName(), ignoreFailure);
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(fieldName, script);
|
return Objects.hash(fieldName, script, ignoreFailure);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1108,7 +1134,9 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ScriptField other = (ScriptField) obj;
|
ScriptField other = (ScriptField) obj;
|
||||||
return Objects.equals(fieldName, other.fieldName) && Objects.equals(script, other.script);
|
return Objects.equals(fieldName, other.fieldName)
|
||||||
|
&& Objects.equals(script, other.script)
|
||||||
|
&& Objects.equals(ignoreFailure, other.ignoreFailure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1197,7 +1225,12 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
builder.sorts = sorts;
|
builder.sorts = sorts;
|
||||||
}
|
}
|
||||||
if (in.readBoolean()) {
|
if (in.readBoolean()) {
|
||||||
builder.stats = in.readStringArray();
|
int size = in.readVInt();
|
||||||
|
List<String> stats = new ArrayList<>();
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
stats.add(in.readString());
|
||||||
|
}
|
||||||
|
builder.stats = stats;
|
||||||
}
|
}
|
||||||
if (in.readBoolean()) {
|
if (in.readBoolean()) {
|
||||||
builder.suggestBuilder = in.readBytesReference();
|
builder.suggestBuilder = in.readBytesReference();
|
||||||
|
@ -1308,7 +1341,10 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
boolean hasStats = stats != null;
|
boolean hasStats = stats != null;
|
||||||
out.writeBoolean(hasStats);
|
out.writeBoolean(hasStats);
|
||||||
if (hasStats) {
|
if (hasStats) {
|
||||||
out.writeStringArray(stats);
|
out.writeVInt(stats.size());
|
||||||
|
for (String stat : stats) {
|
||||||
|
out.writeString(stat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
boolean hasSuggestBuilder = suggestBuilder != null;
|
boolean hasSuggestBuilder = suggestBuilder != null;
|
||||||
out.writeBoolean(hasSuggestBuilder);
|
out.writeBoolean(hasSuggestBuilder);
|
||||||
|
@ -1330,7 +1366,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(aggregations, defaultRescoreWindowSize, explain, fetchSourceContext, fieldDataFields, fieldNames, from,
|
return Objects.hash(aggregations, defaultRescoreWindowSize, explain, fetchSourceContext, fieldDataFields, fieldNames, from,
|
||||||
highlightBuilder, indexBoost, innerHitsBuilder, minScore, postQueryBuilder, queryBuilder, rescoreBuilders, scriptFields,
|
highlightBuilder, indexBoost, innerHitsBuilder, minScore, postQueryBuilder, queryBuilder, rescoreBuilders, scriptFields,
|
||||||
size, sorts, Arrays.hashCode(stats), suggestBuilder, terminateAfter, timeoutInMillis, trackScores, version);
|
size, sorts, stats, suggestBuilder, terminateAfter, timeoutInMillis, trackScores, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1359,7 +1395,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
||||||
&& Objects.equals(scriptFields, other.scriptFields)
|
&& Objects.equals(scriptFields, other.scriptFields)
|
||||||
&& Objects.equals(size, other.size)
|
&& Objects.equals(size, other.size)
|
||||||
&& Objects.equals(sorts, other.sorts)
|
&& Objects.equals(sorts, other.sorts)
|
||||||
&& Objects.deepEquals(stats, other.stats)
|
&& Objects.equals(stats, other.stats)
|
||||||
&& Objects.equals(suggestBuilder, other.suggestBuilder)
|
&& Objects.equals(suggestBuilder, other.suggestBuilder)
|
||||||
&& Objects.equals(terminateAfter, other.terminateAfter)
|
&& Objects.equals(terminateAfter, other.terminateAfter)
|
||||||
&& Objects.equals(timeoutInMillis, other.timeoutInMillis)
|
&& Objects.equals(timeoutInMillis, other.timeoutInMillis)
|
||||||
|
|
|
@ -294,7 +294,11 @@ public class NewSearchSourceBuilderTests extends ESTestCase {
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
int scriptFieldsSize = randomInt(25);
|
int scriptFieldsSize = randomInt(25);
|
||||||
for (int i = 0; i < scriptFieldsSize; i++) {
|
for (int i = 0; i < scriptFieldsSize; i++) {
|
||||||
builder.scriptField(randomAsciiOfLengthBetween(5, 50), new Script("foo"));
|
if (randomBoolean()) {
|
||||||
|
builder.scriptField(randomAsciiOfLengthBetween(5, 50), new Script("foo"), randomBoolean());
|
||||||
|
} else {
|
||||||
|
builder.scriptField(randomAsciiOfLengthBetween(5, 50), new Script("foo"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
|
@ -333,9 +337,10 @@ public class NewSearchSourceBuilderTests extends ESTestCase {
|
||||||
builder.fetchSource(fetchSourceContext);
|
builder.fetchSource(fetchSourceContext);
|
||||||
}
|
}
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
String[] statsGroups = new String[randomIntBetween(0, 20)];
|
int size = randomIntBetween(0, 20);
|
||||||
for (int i = 0; i < statsGroups.length; i++) {
|
List<String> statsGroups = new ArrayList<>(size);
|
||||||
statsGroups[i] = randomAsciiOfLengthBetween(5, 20);
|
for (int i = 0; i < size; i++) {
|
||||||
|
statsGroups.add(randomAsciiOfLengthBetween(5, 20));
|
||||||
}
|
}
|
||||||
builder.stats(statsGroups);
|
builder.stats(statsGroups);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue