diff --git a/core/src/main/java/org/elasticsearch/index/mapper/MappedFieldType.java b/core/src/main/java/org/elasticsearch/index/mapper/MappedFieldType.java index 4c544dbf37c..fff041090a8 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/MappedFieldType.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/MappedFieldType.java @@ -460,7 +460,7 @@ public abstract class MappedFieldType extends FieldType { return new FuzzyQuery(createTerm(value), fuzziness.asDistance(BytesRefs.toString(value)), prefixLength, maxExpansions, transpositions); } - public Query prefixQuery(Object value, @Nullable MultiTermQuery.RewriteMethod method, @Nullable QueryParseContext context) { + public Query prefixQuery(String value, @Nullable MultiTermQuery.RewriteMethod method, @Nullable QueryParseContext context) { PrefixQuery query = new PrefixQuery(createTerm(value)); if (method != null) { query.setRewriteMethod(method); diff --git a/core/src/main/java/org/elasticsearch/index/mapper/internal/IdFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/internal/IdFieldMapper.java index 3e5a5092228..63fa41faea1 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/internal/IdFieldMapper.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/internal/IdFieldMapper.java @@ -184,7 +184,7 @@ public class IdFieldMapper extends MetadataFieldMapper { } @Override - public Query prefixQuery(Object value, @Nullable MultiTermQuery.RewriteMethod method, @Nullable QueryParseContext context) { + public Query prefixQuery(String value, @Nullable MultiTermQuery.RewriteMethod method, @Nullable QueryParseContext context) { if (indexOptions() != IndexOptions.NONE || context == null) { return super.prefixQuery(value, method, context); } diff --git a/core/src/main/java/org/elasticsearch/index/query/PrefixQueryParser.java b/core/src/main/java/org/elasticsearch/index/query/PrefixQueryParser.java index 078e597bcab..56387d90751 100644 --- a/core/src/main/java/org/elasticsearch/index/query/PrefixQueryParser.java +++ b/core/src/main/java/org/elasticsearch/index/query/PrefixQueryParser.java @@ -55,7 +55,7 @@ public class PrefixQueryParser implements QueryParser { String rewriteMethod = null; String queryName = null; - Object value = null; + String value = null; float boost = 1.0f; String currentFieldName = null; XContentParser.Token token; @@ -73,7 +73,7 @@ public class PrefixQueryParser implements QueryParser { if ("_name".equals(currentFieldName)) { queryName = parser.text(); } else if ("value".equals(currentFieldName) || "prefix".equals(currentFieldName)) { - value = parser.objectBytes(); + value = parser.textOrNull(); } else if ("boost".equals(currentFieldName)) { boost = parser.floatValue(); } else if ("rewrite".equals(currentFieldName)) { @@ -88,7 +88,7 @@ public class PrefixQueryParser implements QueryParser { queryName = parser.text(); } else { fieldName = currentFieldName; - value = parser.objectBytes(); + value = parser.textOrNull(); } } }