Tom Blackford created OAK-12013:
-----------------------------------

             Summary: Oak Elastic 'more_like_this' query does not include path 
restriction
                 Key: OAK-12013
                 URL: https://issues.apache.org/jira/browse/OAK-12013
             Project: Jackrabbit Oak
          Issue Type: Bug
          Components: elastic-search
            Reporter: Tom Blackford
         Attachments: elasticQuery.json

For a query like - 
```
/jcr:root/content/dam/folder1/subFolder1//element(*, dam:Asset)[(rep:similar(., 
'/content/dam/myasset.png'))]
```
...the generated Elastic query (for example  [^elasticQuery.json]) does not 
seem to include the restriction on path (which would look something like [1]). 

As such the Elastic query returns results from all over the nodestore, which 
then get filtered out in Oak - see [2] - making the overall query extremely 
slow. 

[1]
{code}
{"bool":{"filter":[{"term":{":ancestors":{"value":"/content/dam/folder1/subFolder1"}}}
{code}

[2]
{code}
20.11.2025 11:51:38.763 *TRACE* [elasticsearch-rest-client-0-thread-6] 
org.apache.jackrabbit.oak.plugins.index.elastic.query.async.ElasticResultRowAsyncIterator
 Path /content/dam/anotherfolder/testasset.jpg not included because of 
hierarchy inclusion rules
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to