Skip to content

Commit 9d90d05

Browse files
authored
Allow unmapped fields in MultiClustersIT tests (elastic#120873)
The message_id field may be unmapped if documents were indexed into some indices but not all. This change specifies the unmapped type for message_id, allowing it to be sorted in such cases. Closes elastic#120796
1 parent bc57545 commit 9d90d05

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/data-streams/src/javaRestTest/java/org/elasticsearch/datastreams/MultiClustersIT.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,11 @@ public void testSource() throws IOException {
184184
final boolean sorted = randomBoolean();
185185
if (sorted) {
186186
searchSource.startArray("sort");
187-
searchSource.value("message_id");
187+
searchSource.startObject();
188+
searchSource.startObject("message_id");
189+
searchSource.field("unmapped_type", "long"); // message_id can be unmapped if no doc is indexed.
190+
searchSource.endObject();
191+
searchSource.endObject();
188192
searchSource.endArray();
189193
}
190194
final Predicate<String> filterHost;

0 commit comments

Comments
 (0)