I am trying to control read access to an index using DLS, based on matching the host field with a given regexp.
Documentation for this is limited and I haven't found any examples that use a regexp. I've tried a few different things but at this point I would like to at least confirm this is even possible.
Currently the query looks like:
elastic_dls_test:
- indices:
'index1_*':
'*':
- READ
_dls_: '{"bool": { "filter": { "regexp": { "host.keyword": {"value": "/hostname_to_match[0-9]*/"} }}}}}'
This doesn't seem to filter anything for users in the role elastic_dls_test.
Yes, it should be possible. You can use any Elasticsearch query for DLS, including regex ones. Without having a look at the rest of the configuration and the underlying data it is hard to tell why it is not working. But there a couple of general steps to debug the problem:
It would also help if you posted a sample document from one of your index1_* indices.