I'm having a problem with the Content access search processor on elasticsearch 6. I'm actually not sure if this is a problem with search API or elasticsearch connector, but I'll start here first.
As soon as I activate the processor, all custom entities disappear from anonymous searches. We use quite a lot of custom entities in our search, so it's a major problem. I tried to debug this issue, and here's what I found:
- processor creates a condition group, and treats some content types as 'affected' and some as 'unaffected'. It creates a big OR condition, that should pass all of the unaffected content types and check some more data for the affected ones. Here's the stringified condition (for an anonymous user).
[
search_api_datasource = 'entity:adapter_servicenow_kb'
OR
search_api_datasource = 'entity:file'
OR
search_api_datasource = 'entity:group'
OR
search_api_datasource = 'entity:user'
OR
[
status = true
AND
[
node_grants = 'node_access_all:0'
OR
node_grants = 'node_access_gnode_anonymous:1986'
OR
node_grants = 'node_access__all'
]
]
]
- All the checks (four of them at the top) that should be unaffected by the processor and pass right away actually don't and are not shown in search results
- It doesn't happen only for anonymous users, anyone without the 'bypass node access' permission is affected
- I tried changing the condition structure and my conclussion is that once the node_grants field is added to the condition the bug occurs
I will be grateful if you could help me find the source of this issue or point me in the right direction. I also tried debugging the elasticsearch queries that are produced out of this but they weren't as straightforward as the stringified condition above and I had no experience working with raw elasticsearch.