if (request.hasContent()) {
explainRequest.source(request.content(), request.contentUnsafe());
} else if (sourceString != null) {
explainRequest.source(new BytesArray(request.param("source")), false);
} else if (queryString != null) {
QueryStringQueryBuilder queryStringBuilder = QueryBuilders.queryString(queryString);
queryStringBuilder.defaultField(request.param("df"));
queryStringBuilder.analyzer(request.param("analyzer"));
queryStringBuilder.analyzeWildcard(request.paramAsBoolean("analyze_wildcard", false));
queryStringBuilder.lowercaseExpandedTerms(request.paramAsBoolean("lowercase_expanded_terms", true));
queryStringBuilder.lenient(request.paramAsBoolean("lenient", null));
String defaultOperator = request.param("default_operator");
if (defaultOperator != null) {
if ("OR".equals(defaultOperator)) {
queryStringBuilder.defaultOperator(QueryStringQueryBuilder.Operator.OR);
} else if ("AND".equals(defaultOperator)) {
queryStringBuilder.defaultOperator(QueryStringQueryBuilder.Operator.AND);
} else {
throw new ElasticsearchIllegalArgumentException("Unsupported defaultOperator [" + defaultOperator + "], can either be [OR] or [AND]");
}
}