Followup refactoring for elastic/elasticsearch#25787
Original commit: elastic/x-pack-elasticsearch@ab0e5c45ef
This commit is contained in:
parent
ac46b0b0a5
commit
aeed4cb3e4
|
@ -358,8 +358,8 @@ public class SecurityIndexSearcherWrapper extends IndexSearcherWrapper {
|
||||||
throw new IllegalStateException("role queries are not allowed to execute additional requests");
|
throw new IllegalStateException("role queries are not allowed to execute additional requests");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
QueryRewriteContext copy = new QueryRewriteContext(original.getIndexSettings(), original.getMapperService(), scriptService,
|
QueryRewriteContext copy = new QueryRewriteContext(
|
||||||
original.getXContentRegistry(), client, original.getIndexReader(), original::nowInMillis);
|
original.getXContentRegistry(), client, original::nowInMillis);
|
||||||
queryBuilder.rewrite(copy);
|
queryBuilder.rewrite(copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -679,7 +679,7 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase {
|
||||||
Client client = mock(Client.class);
|
Client client = mock(Client.class);
|
||||||
when(client.settings()).thenReturn(Settings.EMPTY);
|
when(client.settings()).thenReturn(Settings.EMPTY);
|
||||||
final long nowInMillis = randomNonNegativeLong();
|
final long nowInMillis = randomNonNegativeLong();
|
||||||
QueryRewriteContext context = new QueryRewriteContext(null, null, scriptService, xContentRegistry(), client, null,
|
QueryRewriteContext context = new QueryRewriteContext(xContentRegistry(), client,
|
||||||
() -> nowInMillis);
|
() -> nowInMillis);
|
||||||
QueryBuilder queryBuilder1 = new TermsQueryBuilder("field", "val1", "val2");
|
QueryBuilder queryBuilder1 = new TermsQueryBuilder("field", "val1", "val2");
|
||||||
SecurityIndexSearcherWrapper.failIfQueryUsesClient(scriptService, queryBuilder1, context);
|
SecurityIndexSearcherWrapper.failIfQueryUsesClient(scriptService, queryBuilder1, context);
|
||||||
|
|
Loading…
Reference in New Issue