|
35 | 35 | import org.apache.lucene.search.ScoreDoc;
|
36 | 36 | import org.apache.lucene.search.TopDocs;
|
37 | 37 | import org.apache.lucene.search.TotalHits;
|
38 |
| -import org.opensearch.LegacyESVersion; |
39 | 38 | import org.opensearch.Version;
|
40 | 39 | import org.opensearch.action.OriginalIndices;
|
41 | 40 | import org.opensearch.action.OriginalIndicesTests;
|
42 | 41 | import org.opensearch.action.search.SearchRequest;
|
43 | 42 | import org.opensearch.common.Strings;
|
44 | 43 | import org.opensearch.common.UUIDs;
|
45 |
| -import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput; |
46 | 44 | import org.opensearch.common.io.stream.NamedWriteableRegistry;
|
47 |
| -import org.opensearch.common.io.stream.StreamInput; |
48 | 45 | import org.opensearch.common.lucene.search.TopDocsAndMaxScore;
|
49 | 46 | import org.opensearch.common.settings.Settings;
|
50 | 47 | import org.opensearch.index.shard.ShardId;
|
51 | 48 | import org.opensearch.search.DocValueFormat;
|
52 | 49 | import org.opensearch.search.SearchModule;
|
53 | 50 | import org.opensearch.search.SearchShardTarget;
|
54 | 51 | import org.opensearch.search.aggregations.Aggregations;
|
55 |
| -import org.opensearch.search.aggregations.InternalAggregations; |
56 | 52 | import org.opensearch.search.aggregations.InternalAggregationsTests;
|
57 | 53 | import org.opensearch.search.internal.AliasFilter;
|
58 | 54 | import org.opensearch.search.internal.ShardSearchContextId;
|
59 | 55 | import org.opensearch.search.internal.ShardSearchRequest;
|
60 | 56 | import org.opensearch.search.suggest.SuggestTests;
|
61 | 57 | import org.opensearch.test.OpenSearchTestCase;
|
62 | 58 |
|
63 |
| -import java.io.IOException; |
64 |
| -import java.util.Base64; |
65 |
| - |
66 | 59 | import static java.util.Collections.emptyList;
|
67 | 60 |
|
68 | 61 | public class QuerySearchResultTests extends OpenSearchTestCase {
|
@@ -127,32 +120,6 @@ public void testSerialization() throws Exception {
|
127 | 120 | assertEquals(querySearchResult.terminatedEarly(), deserialized.terminatedEarly());
|
128 | 121 | }
|
129 | 122 |
|
130 |
| - public void testReadFromPre_7_1_0() throws IOException { |
131 |
| - String message = "AAAAAAAAAGQAAAEAAAB/wAAAAAEBBnN0ZXJtcwVJblhNRgoDBVNhdWpvAAVrS3l3cwVHSVVZaAAFZXRUbEUFZGN0WVoABXhzYnVrAAEDAfoN" |
132 |
| - + "A3JhdwUBAAJRAAAAAAAAA30DBnN0ZXJtcwVNdVVFRwoAAAEDAfoNA3JhdwUBAAdDAAAAAAAAA30AAApQVkFhaUxSdHh5TAAAAAAAAAN9AAAKTVRUeUxnd1hyd" |
133 |
| - + "y0AAAAAAAADfQAACnZRQXZ3cWp0SmwPAAAAAAAAA30AAApmYXNyUUhNVWZBCwAAAAAAAAN9AAAKT3FIQ2RMZ1JZUwUAAAAAAAADfQAACm9jT05aZmZ4ZmUmAA" |
134 |
| - + "AAAAAAA30AAApvb0tJTkdvbHdzBnN0ZXJtcwVtRmlmZAoAAAEDAfoNA3JhdwUBAARXAAAAAAAAA30AAApZd3BwQlpBZEhpMQAAAAAAAAN9AAAKREZ3UVpTSXh" |
135 |
| - + "DSE4AAAAAAAADfQAAClVMZW1YZGtkSHUUAAAAAAAAA30AAApBUVdKVk1kTlF1BnN0ZXJtcwVxbkJGVgoAAAEDAfoNA3JhdwUBAAYJAAAAAAAAA30AAApBS2NL" |
136 |
| - + "U1ZVS25EIQAAAAAAAAN9AAAKWGpCbXZBZmduRhsAAAAAAAADfQAACk54TkJEV3pLRmI7AAAAAAAAA30AAApydkdaZnJycXhWSAAAAAAAAAN9AAAKSURVZ3JhQ" |
137 |
| - + "lFHSy4AAAAAAAADfQAACmJmZ0x5YlFlVksAClRJZHJlSkpVc1Y4AAAAAAAAA30DBnN0ZXJtcwVNdVVFRwoAAAEDAfoNA3JhdwUBAAdDAAAAAAAAA30AAApQVk" |
138 |
| - + "FhaUxSdHh5TAAAAAAAAAN9AAAKTVRUeUxnd1hydy0AAAAAAAADfQAACnZRQXZ3cWp0SmwPAAAAAAAAA30AAApmYXNyUUhNVWZBCwAAAAAAAAN9AAAKT3FIQ2R" |
139 |
| - + "MZ1JZUwUAAAAAAAADfQAACm9jT05aZmZ4ZmUmAAAAAAAAA30AAApvb0tJTkdvbHdzBnN0ZXJtcwVtRmlmZAoAAAEDAfoNA3JhdwUBAARXAAAAAAAAA30AAApZ" |
140 |
| - + "d3BwQlpBZEhpMQAAAAAAAAN9AAAKREZ3UVpTSXhDSE4AAAAAAAADfQAAClVMZW1YZGtkSHUUAAAAAAAAA30AAApBUVdKVk1kTlF1BnN0ZXJtcwVxbkJGVgoAA" |
141 |
| - + "AEDAfoNA3JhdwUBAAYJAAAAAAAAA30AAApBS2NLU1ZVS25EIQAAAAAAAAN9AAAKWGpCbXZBZmduRhsAAAAAAAADfQAACk54TkJEV3pLRmI7AAAAAAAAA30AAA" |
142 |
| - + "pydkdaZnJycXhWSAAAAAAAAAN9AAAKSURVZ3JhQlFHSy4AAAAAAAADfQAACmJmZ0x5YlFlVksACm5rdExLUHp3cGgBCm1heF9idWNrZXQFbmFtZTEBB2J1Y2t" |
143 |
| - + "ldDH/A3JhdwEBCm1heF9idWNrZXQFbmFtZTEBB2J1Y2tldDH/A3JhdwEAAAIAAf////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; |
144 |
| - byte[] bytes = Base64.getDecoder().decode(message); |
145 |
| - try (NamedWriteableAwareStreamInput in = new NamedWriteableAwareStreamInput(StreamInput.wrap(bytes), namedWriteableRegistry)) { |
146 |
| - in.setVersion(LegacyESVersion.V_7_0_0); |
147 |
| - QuerySearchResult querySearchResult = new QuerySearchResult(in); |
148 |
| - assertEquals(100, querySearchResult.getContextId().getId()); |
149 |
| - assertTrue(querySearchResult.hasAggs()); |
150 |
| - InternalAggregations aggs = querySearchResult.consumeAggs().expand(); |
151 |
| - assertEquals(1, aggs.asList().size()); |
152 |
| - // We deserialize and throw away top level pipeline aggs |
153 |
| - } |
154 |
| - } |
155 |
| - |
156 | 123 | public void testNullResponse() throws Exception {
|
157 | 124 | QuerySearchResult querySearchResult = QuerySearchResult.nullInstance();
|
158 | 125 | QuerySearchResult deserialized = copyWriteable(querySearchResult, namedWriteableRegistry, QuerySearchResult::new, Version.CURRENT);
|
|
0 commit comments