|
46 | 46 | import java.util.HashMap;
|
47 | 47 | import java.util.List;
|
48 | 48 | import java.util.Objects;
|
| 49 | +import java.util.stream.Collectors; |
49 | 50 |
|
50 | 51 | /**
|
51 | 52 | * Query sub phase which pulls data from doc values
|
@@ -77,17 +78,22 @@ public void hitsExecute(SearchContext context, SearchHit[] hits) throws IOExcept
|
77 | 78 | hits = hits.clone(); // don't modify the incoming hits
|
78 | 79 | Arrays.sort(hits, Comparator.comparingInt(SearchHit::docId));
|
79 | 80 |
|
| 81 | + List<String> noFormatFields = context.docValueFieldsContext().fields().stream().filter(f -> f.format == null).map(f -> f.field) |
| 82 | + .collect(Collectors.toList()); |
| 83 | + if (noFormatFields.isEmpty() == false) { |
| 84 | + DEPRECATION_LOGGER.deprecated("There are doc-value fields which are not using a format. The output will " |
| 85 | + + "change in 7.0 when doc value fields get formatted based on mappings by default. It is recommended to pass " |
| 86 | + + "[format={}] with a doc value field in order to opt in for the future behaviour and ease the migration to " |
| 87 | + + "7.0: {}", DocValueFieldsContext.USE_DEFAULT_FORMAT, noFormatFields); |
| 88 | + } |
| 89 | + |
80 | 90 | for (FieldAndFormat fieldAndFormat : context.docValueFieldsContext().fields()) {
|
81 | 91 | String field = fieldAndFormat.field;
|
82 | 92 | MappedFieldType fieldType = context.mapperService().fullName(field);
|
83 | 93 | if (fieldType != null) {
|
84 | 94 | final IndexFieldData<?> indexFieldData = context.getForField(fieldType);
|
85 | 95 | final DocValueFormat format;
|
86 | 96 | if (fieldAndFormat.format == null) {
|
87 |
| - DEPRECATION_LOGGER.deprecated("Doc-value field [" + fieldAndFormat.field + "] is not using a format. The output will " + |
88 |
| - "change in 7.0 when doc value fields get formatted based on mappings by default. It is recommended to pass " + |
89 |
| - "[format={}] with the doc value field in order to opt in for the future behaviour and ease the migration to " + |
90 |
| - "7.0.", DocValueFieldsContext.USE_DEFAULT_FORMAT); |
91 | 97 | format = null;
|
92 | 98 | } else {
|
93 | 99 | String formatDesc = fieldAndFormat.format;
|
|
0 commit comments