diff --git a/server/src/test/java/org/elasticsearch/search/suggest/SuggestTests.java b/server/src/test/java/org/elasticsearch/search/suggest/SuggestTests.java index b6fa1e236a843..d209f15a641f5 100644 --- a/server/src/test/java/org/elasticsearch/search/suggest/SuggestTests.java +++ b/server/src/test/java/org/elasticsearch/search/suggest/SuggestTests.java @@ -239,7 +239,6 @@ public void testMergingSuggestionOptions() { assertTrue(option1.collateMatch()); } - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/95607") public void testSerialization() throws IOException { TransportVersion bwcVersion = TransportVersionUtils.randomVersionBetween( random(), @@ -248,6 +247,22 @@ public void testSerialization() throws IOException { ); final Suggest suggest = createTestItem(); + // suggest is disallowed when using rank, but the randomization rarely sets it + // we need to make sure CompletionSuggestion$Entry$Option doesn't have "rank" set + // because for some older versions it will not serialize. + if (bwcVersion.before(TransportVersions.V_8_8_0)) { + for (CompletionSuggestion s : suggest.filter(CompletionSuggestion.class)) { + for (CompletionSuggestion.Entry entry : s.entries) { + List options = entry.getOptions(); + for (CompletionSuggestion.Entry.Option o : entry.getOptions()) { + if (o.getHit() != null) { + o.getHit().setRank(-1); + } + } + } + } + } + final Suggest bwcSuggest; NamedWriteableRegistry registry = new NamedWriteableRegistry(new SearchModule(Settings.EMPTY, emptyList()).getNamedWriteables());