diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/SortParseElement.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/SortParseElement.java index f5e1cba9833..021269dbdc4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/SortParseElement.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/sort/SortParseElement.java @@ -142,7 +142,7 @@ public class SortParseElement implements SearchParseElement { if (fieldMapper == null) { throw new SearchParseException(context, "No mapping found for [" + fieldName + "]"); } - sortFields.add(new SortField(fieldName, fieldMapper.fieldDataType().newFieldComparatorSource(context.fieldDataCache(), missing), reverse)); + sortFields.add(new SortField(fieldMapper.names().indexName(), fieldMapper.fieldDataType().newFieldComparatorSource(context.fieldDataCache(), missing), reverse)); } } }