fix compile errors
This commit is contained in:
parent
b98f7cf023
commit
ac8c1722ac
|
@ -28,7 +28,6 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.indices.query.IndicesQueriesRegistry;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -77,7 +76,7 @@ public class RestPutWarmerAction extends BaseRestHandler {
|
|||
|
||||
BytesReference sourceBytes = RestActions.getRestContent(request);
|
||||
XContentParser parser = XContentFactory.xContent(sourceBytes).createParser(sourceBytes);
|
||||
QueryParseContext queryParseContext = new QueryParseContext(new Index(""), queryRegistry); // NORELEASE remove index
|
||||
QueryParseContext queryParseContext = new QueryParseContext(queryRegistry);
|
||||
queryParseContext.reset(parser);
|
||||
SearchSourceBuilder source = SearchSourceBuilder.PROTOTYPE.fromXContent(parser, queryParseContext);
|
||||
SearchRequest searchRequest = new SearchRequest(Strings.splitStringByCommaToArray(request.param("index")))
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.indices.query.IndicesQueriesRegistry;
|
||||
|
@ -106,11 +105,11 @@ public class RestSearchAction extends BaseRestHandler {
|
|||
if (isTemplateRequest) {
|
||||
searchRequest.templateSource(RestActions.getRestContent(request));
|
||||
} else {
|
||||
BytesReference sourceBytes = RestActions.getRestContent(request);
|
||||
XContentParser parser = XContentFactory.xContent(sourceBytes).createParser(sourceBytes);
|
||||
QueryParseContext queryParseContext = new QueryParseContext(new Index(""), queryRegistry); // NORELEASE remove index
|
||||
queryParseContext.reset(parser);
|
||||
searchRequest.source(SearchSourceBuilder.PROTOTYPE.fromXContent(parser, queryParseContext));
|
||||
BytesReference sourceBytes = RestActions.getRestContent(request);
|
||||
XContentParser parser = XContentFactory.xContent(sourceBytes).createParser(sourceBytes);
|
||||
QueryParseContext queryParseContext = new QueryParseContext(queryRegistry);
|
||||
queryParseContext.reset(parser);
|
||||
searchRequest.source(SearchSourceBuilder.PROTOTYPE.fromXContent(parser, queryParseContext));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -687,8 +687,8 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
|||
XContentParser.Token token;
|
||||
String currentFieldName = null;
|
||||
if ((token = parser.nextToken()) != XContentParser.Token.START_OBJECT) {
|
||||
throw new ParsingException(context, "Expected [" + XContentParser.Token.START_OBJECT + "] but found [" + token + "]",
|
||||
parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Expected [" + XContentParser.Token.START_OBJECT + "] but found ["
|
||||
+ token + "]");
|
||||
}
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
|
@ -718,8 +718,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
|||
fieldNames.add(parser.text());
|
||||
builder.fieldNames = fieldNames;
|
||||
} else {
|
||||
throw new ParsingException(context, "Unknown key for a " + token + " in [" + currentFieldName + "].",
|
||||
parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName + "].");
|
||||
}
|
||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||
if (context.parseFieldMatcher().match(currentFieldName, QUERY_FIELD)) {
|
||||
|
@ -743,24 +742,25 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
|||
scriptFields
|
||||
.add(new ScriptField(scriptFieldName, Script.parse(parser, context.parseFieldMatcher())));
|
||||
} else {
|
||||
throw new ParsingException(context, "Unknown key for a " + token + " in [" + currentFieldName
|
||||
+ "].", parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in ["
|
||||
+ currentFieldName + "].");
|
||||
}
|
||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||
if (context.parseFieldMatcher().match(currentFieldName, SCRIPT_FIELD)) {
|
||||
scriptFields
|
||||
.add(new ScriptField(scriptFieldName, Script.parse(parser, context.parseFieldMatcher())));
|
||||
} else {
|
||||
throw new ParsingException(context, "Unknown key for a " + token + " in [" + currentFieldName
|
||||
+ "].", parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in ["
|
||||
+ currentFieldName + "].");
|
||||
}
|
||||
} else {
|
||||
throw new ParsingException(context, "Unknown key for a " + token + " in [" + currentFieldName
|
||||
+ "].", parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in ["
|
||||
+ currentFieldName + "].");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new ParsingException(context, "Expected [" + XContentParser.Token.START_OBJECT + "] in ["
|
||||
throw new ParsingException(parser.getTokenLocation(), "Expected [" + XContentParser.Token.START_OBJECT
|
||||
+ "] in ["
|
||||
+ currentFieldName + "] but found [" + token + "]", parser.getTokenLocation());
|
||||
}
|
||||
}
|
||||
|
@ -773,8 +773,8 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
|||
} else if (token.isValue()) {
|
||||
indexBoost.put(currentFieldName, parser.floatValue());
|
||||
} else {
|
||||
throw new ParsingException(context, "Unknown key for a " + token + " in [" + currentFieldName + "].",
|
||||
parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName
|
||||
+ "].");
|
||||
}
|
||||
}
|
||||
builder.indexBoost = indexBoost;
|
||||
|
@ -791,8 +791,8 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
|||
xContentBuilder.endObject();
|
||||
aggregations.add(xContentBuilder.bytes());
|
||||
} else {
|
||||
throw new ParsingException(context, "Unknown key for a " + token + " in [" + currentFieldName + "].",
|
||||
parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName
|
||||
+ "].");
|
||||
}
|
||||
}
|
||||
builder.aggregations = aggregations;
|
||||
|
@ -806,8 +806,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
|||
XContentBuilder xContentBuilder = XContentFactory.contentBuilder(parser.contentType()).copyCurrentStructure(parser);
|
||||
builder.suggestBuilder = xContentBuilder.bytes();
|
||||
} else {
|
||||
throw new ParsingException(context, "Unknown key for a " + token + " in [" + currentFieldName + "].",
|
||||
parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName + "].");
|
||||
}
|
||||
} else if (token == XContentParser.Token.START_ARRAY) {
|
||||
if (context.parseFieldMatcher().match(currentFieldName, FIELDS_FIELD)) {
|
||||
|
@ -816,8 +815,8 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
|||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
fieldNames.add(parser.text());
|
||||
} else {
|
||||
throw new ParsingException(context, "Expected [" + XContentParser.Token.VALUE_STRING + "] in ["
|
||||
+ currentFieldName + "] but found [" + token + "]", parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Expected [" + XContentParser.Token.VALUE_STRING
|
||||
+ "] in [" + currentFieldName + "] but found [" + token + "]");
|
||||
}
|
||||
}
|
||||
builder.fieldNames = fieldNames;
|
||||
|
@ -827,8 +826,8 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
|||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
fieldDataFields.add(parser.text());
|
||||
} else {
|
||||
throw new ParsingException(context, "Expected [" + XContentParser.Token.VALUE_STRING + "] in ["
|
||||
+ currentFieldName + "] but found [" + token + "]", parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Expected [" + XContentParser.Token.VALUE_STRING
|
||||
+ "] in [" + currentFieldName + "] but found [" + token + "]");
|
||||
}
|
||||
}
|
||||
builder.fieldDataFields = fieldDataFields;
|
||||
|
@ -852,18 +851,16 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
|
|||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
stats.add(parser.text());
|
||||
} else {
|
||||
throw new ParsingException(context, "Expected [" + XContentParser.Token.VALUE_STRING + "] in ["
|
||||
+ currentFieldName + "] but found [" + token + "]", parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Expected [" + XContentParser.Token.VALUE_STRING
|
||||
+ "] in [" + currentFieldName + "] but found [" + token + "]");
|
||||
}
|
||||
}
|
||||
builder.stats = stats.toArray(new String[stats.size()]);
|
||||
} else {
|
||||
throw new ParsingException(context, "Unknown key for a " + token + " in [" + currentFieldName + "].",
|
||||
parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName + "].");
|
||||
}
|
||||
} else {
|
||||
throw new ParsingException(context, "Unknown key for a " + token + " in [" + currentFieldName + "].",
|
||||
parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName + "].");
|
||||
}
|
||||
}
|
||||
return builder;
|
||||
|
|
|
@ -206,8 +206,8 @@ public class FetchSourceContext implements Streamable, ToXContent {
|
|||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
includesList.add(parser.text());
|
||||
} else {
|
||||
throw new ParsingException(context, "Unknown key for a " + token + " in [" + currentFieldName + "].",
|
||||
parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in ["
|
||||
+ currentFieldName + "].");
|
||||
}
|
||||
}
|
||||
includes = includesList.toArray(new String[includesList.size()]);
|
||||
|
@ -217,23 +217,22 @@ public class FetchSourceContext implements Streamable, ToXContent {
|
|||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
excludesList.add(parser.text());
|
||||
} else {
|
||||
throw new ParsingException(context, "Unknown key for a " + token + " in [" + currentFieldName + "].",
|
||||
parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in ["
|
||||
+ currentFieldName + "].");
|
||||
}
|
||||
}
|
||||
excludes = excludesList.toArray(new String[excludesList.size()]);
|
||||
} else {
|
||||
throw new ParsingException(context, "Unknown key for a " + token + " in [" + currentFieldName + "].",
|
||||
parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName
|
||||
+ "].");
|
||||
}
|
||||
} else {
|
||||
throw new ParsingException(context, "Unknown key for a " + token + " in [" + currentFieldName + "].",
|
||||
parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName + "].");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new ParsingException(context, "Expected one of [" + XContentParser.Token.VALUE_BOOLEAN + ", "
|
||||
+ XContentParser.Token.START_OBJECT + "] but found [" + token + "]", parser.getTokenLocation());
|
||||
throw new ParsingException(parser.getTokenLocation(), "Expected one of [" + XContentParser.Token.VALUE_BOOLEAN + ", "
|
||||
+ XContentParser.Token.START_OBJECT + "] but found [" + token + "]");
|
||||
}
|
||||
this.fetchSource = fetchSource;
|
||||
this.includes = includes;
|
||||
|
|
Loading…
Reference in New Issue