elasticsearch
elasticsearch copied to clipboard
Use internal reader when building SecurityIndexReaderWrapper filter query
Relates: https://github.com/elastic/elasticsearch/issues/112130
When using wildcards to match fields in a multi_match
query within a DLS query in a role, the fields are not properly expanded because there is no index reader that can read the index mapping to expand the wildcards.
This happens because a searcher is needed to read the mappings to figure out what fields are available for an index.
The searcher is expected to be supplied by the Security plugin when it calls IndexModule::setReaderWrapper
to override the IndexReader
factory. Currently it passes null
for the searcher parameter, which makes expansions of wildcard fields impossible.
This PR changes that by providing the reader that wrapped by SecurityIndexReaderWrapper
when the filter query is built to be able to resolve wildcard fields.