XPack changes for: https://github.com/elastic/elasticsearch/pull/25456
Original commit: elastic/x-pack-elasticsearch@9d1d3c3fb4
This commit is contained in:
parent
bb360c1ff3
commit
5f51dd813c
|
@ -352,7 +352,7 @@ public class SecurityIndexSearcherWrapper extends IndexSearcherWrapper {
|
|||
static void failIfQueryUsesClient(QueryBuilder queryBuilder, QueryRewriteContext original)
|
||||
throws IOException {
|
||||
QueryRewriteContext copy = new QueryRewriteContext(
|
||||
original.getXContentRegistry(), null, original::nowInMillis);
|
||||
original.getXContentRegistry(), original.getWriteableRegistry(), null, original::nowInMillis);
|
||||
Rewriteable.rewrite(queryBuilder, copy);
|
||||
if (copy.hasAsyncActions()) {
|
||||
throw new IllegalStateException("role queries are not allowed to execute additional requests");
|
||||
|
|
|
@ -72,7 +72,7 @@ public class SecurityIndexSearcherWrapperIntegrationTests extends ESTestCase {
|
|||
when(client.settings()).thenReturn(Settings.EMPTY);
|
||||
final long nowInMillis = randomNonNegativeLong();
|
||||
QueryShardContext realQueryShardContext = new QueryShardContext(shardId.id(), indexSettings, null, null, mapperService, null,
|
||||
null, xContentRegistry(), client, null, () -> nowInMillis, null);
|
||||
null, xContentRegistry(), writableRegistry(), client, null, () -> nowInMillis, null);
|
||||
QueryShardContext queryShardContext = spy(realQueryShardContext);
|
||||
IndexSettings settings = IndexSettingsModule.newIndexSettings("_index", Settings.EMPTY);
|
||||
BitsetFilterCache bitsetFilterCache = new BitsetFilterCache(settings, new BitsetFilterCache.Listener() {
|
||||
|
|
|
@ -679,7 +679,7 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase {
|
|||
Client client = mock(Client.class);
|
||||
when(client.settings()).thenReturn(Settings.EMPTY);
|
||||
final long nowInMillis = randomNonNegativeLong();
|
||||
QueryRewriteContext context = new QueryRewriteContext(xContentRegistry(), client,
|
||||
QueryRewriteContext context = new QueryRewriteContext(xContentRegistry(), writableRegistry(), client,
|
||||
() -> nowInMillis);
|
||||
QueryBuilder queryBuilder1 = new TermsQueryBuilder("field", "val1", "val2");
|
||||
SecurityIndexSearcherWrapper.failIfQueryUsesClient(queryBuilder1, context);
|
||||
|
|
Loading…
Reference in New Issue