Explicitly set mappings in SearchAfterIT (#54262)

We have some very occasional failures in SearchAfterIT, where a search throws
an exception because a shard does not have the mapping for the requested sort
field. The field should have been added in a dynamic mapping update after an
index event, but it seems that there can sometimes be a small delay in propagating
this update to the shards.

This commit changes the test to explicitly define the relevant field at index creation
time.

Fixes #51900
This commit is contained in:
Alan Woodward 2020-03-26 13:03:54 +00:00
parent d8f745736b
commit 048797389a
1 changed files with 1 additions and 1 deletions

View File

@ -51,7 +51,7 @@ public class SearchAfterIT extends ESIntegTestCase {
public void testsShouldFail() throws Exception {
assertAcked(client().admin().indices().prepareCreate("test")
.addMapping("type1", "field2", "type=keyword")
.addMapping("type1", "field1", "type=long", "field2", "type=keyword")
.get()
);
ensureGreen();