|
26 | 26 | import org.elasticsearch.cluster.metadata.IndexMetadata;
|
27 | 27 | import org.elasticsearch.common.Nullable;
|
28 | 28 | import org.elasticsearch.common.Strings;
|
| 29 | +import org.elasticsearch.common.UUIDs; |
29 | 30 | import org.elasticsearch.common.compress.CompressedXContent;
|
30 | 31 | import org.elasticsearch.common.settings.Settings;
|
| 32 | +import org.elasticsearch.common.unit.TimeValue; |
31 | 33 | import org.elasticsearch.common.xcontent.DeprecationHandler;
|
32 | 34 | import org.elasticsearch.common.xcontent.ToXContent;
|
33 | 35 | import org.elasticsearch.common.xcontent.XContentBuilder;
|
@@ -81,9 +83,17 @@ private ShardSearchRequest createShardSearchRequest() throws IOException {
|
81 | 83 | filteringAliases = new AliasFilter(null, Strings.EMPTY_ARRAY);
|
82 | 84 | }
|
83 | 85 | final String[] routings = generateRandomStringArray(5, 10, false, true);
|
| 86 | + ShardSearchContextId shardSearchContextId = null; |
| 87 | + TimeValue keepAlive = null; |
| 88 | + if (randomBoolean()) { |
| 89 | + shardSearchContextId = new ShardSearchContextId(UUIDs.randomBase64UUID(), randomNonNegativeLong()); |
| 90 | + if (randomBoolean()) { |
| 91 | + keepAlive = TimeValue.timeValueSeconds(randomIntBetween(0, 120)); |
| 92 | + } |
| 93 | + } |
84 | 94 | ShardSearchRequest req = new ShardSearchRequest(new OriginalIndices(searchRequest), searchRequest, shardId,
|
85 | 95 | randomIntBetween(1, 100), filteringAliases, randomBoolean() ? 1.0f : randomFloat(),
|
86 |
| - Math.abs(randomLong()), randomAlphaOfLengthBetween(3, 10), routings); |
| 96 | + Math.abs(randomLong()), randomAlphaOfLengthBetween(3, 10), routings, shardSearchContextId, keepAlive); |
87 | 97 | req.canReturnNullResponseIfMatchNoDocs(randomBoolean());
|
88 | 98 | if (randomBoolean()) {
|
89 | 99 | req.setBottomSortValues(SearchSortValuesAndFormatsTests.randomInstance());
|
|
0 commit comments