[
https://issues.apache.org/jira/browse/OAK-11743?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mohit Kataria resolved OAK-11743.
---------------------------------
Fix Version/s: 1.82.0
Resolution: Fixed
> Filters only work inside knn query, So filters should be moved to knn query
> also.
> ---------------------------------------------------------------------------------
>
> Key: OAK-11743
> URL: https://issues.apache.org/jira/browse/OAK-11743
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: indexing
> Reporter: Mohit Kataria
> Assignee: Mohit Kataria
> Priority: Major
> Fix For: 1.82.0
>
>
> Buggy sample Elastic query with path filter, in this filter is defined a top
> level.
>
> {noformat}
> {
> "_source": {
> "includes": [
> ":path"
> ]
> },
> "query": {
> "bool": {
> "filter": [
> {
> "term": {
> ":ancestors": {
> "value": "/content/filterPath"
> }
> }
> }
> ],
> "must": [
> {
> "bool": {
> "must": [
> {
> "bool": {
> "should": [
> {
> "nested": {
> "path": ":vectorSpaces.ada-test-model",
> "query": {
> "knn": {
> "field": ":vectorSpaces.ada-test-model.vector",
> "query_vector": [],
> "num_candidates": 100
> }
> }
> }
> },
> {
> "query_string": {
> "boost": 0.03999999910593033,
> "default_operator": "and",
> "fields": [
> "title^1.0",
> "description^1.0",
> "updatedBy^1.0",
> ":fulltext"
> ],
> "lenient": true,
> "query": "technological advancements in electric
> vehicles",
> "tie_breaker": 0.5,
> "type": "cross_fields"
> }
> }
> ]
> }
> }
> ]
> }
> }
> ]
> }
> },
> "size": 10,
> "sort": [
> {
> "_score": {
> "order": "desc"
> }
> },
> {
> ":path": {
> "order": "asc"
> }
> }
> ],
> "track_total_hits": 10000
> }
> {noformat}
> Rectified elastic query where filter is also defined inside knn.
> {noformat}
> {
> "_source": {
> "includes": [
> ":path"
> ]
> },
> "query": {
> "bool": {
> "filter": [
> {
> "term": {
> ":ancestors": {
> "value": "/content/filterPath"
> }
> }
> }
> ],
> "must": [
> {
> "bool": {
> "must": [
> {
> "bool": {
> "should": [
> {
> "nested": {
> "path": ":vectorSpaces.ada-test-model",
> "query": {
> "knn": {
> "field": ":vectorSpaces.ada-test-model.vector",
> "query_vector": [],
> "num_candidates": 100,
> "filter": [
> {
> "term": {
> ":ancestors": {
> "value": "/content/filterPath"
> }
> }
> }
> ]
> }
> }
> }
> },
> {
> "query_string": {
> "boost": 0.03999999910593033,
> "default_operator": "and",
> "fields": [
> "title^1.0",
> "description^1.0",
> "updatedBy^1.0",
> ":fulltext"
> ],
> "lenient": true,
> "query": "technological advancements in electric
> vehicles",
> "tie_breaker": 0.5,
> "type": "cross_fields"
> }
> }
> ]
> }
> }
> ]
> }
> }
> ]
> }
> },
> "size": 10,
> "sort": [
> {
> "_score": {
> "order": "desc"
> }
> },
> {
> ":path": {
> "order": "asc"
> }
> }
> ],
> "track_total_hits": 10000
> }
> {noformat}
> |
--
This message was sent by Atlassian Jira
(v8.20.10#820010)