Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

NOT operator doesn't work as expected with nested field query. #199

Closed
penghuo opened this issue Sep 27, 2019 · 0 comments
Closed

NOT operator doesn't work as expected with nested field query. #199

penghuo opened this issue Sep 27, 2019 · 0 comments
Assignees

Comments

@penghuo
Copy link
Contributor

penghuo commented Sep 27, 2019

The NOT operator doesn't work as expected with nested field query.

SQL

SELECT e.name
FROM employee_nested_it as e, e.projects as p
WHERE not (p is not missing)

Test Data

https://github.com/opendistro-for-elasticsearch/sql/blob/master/src/test/resources/employee_nested.json

Expected Result

    "hits" : [
      {
        "_index" : "employee_nested_it",
        "_type" : "_doc",
        "_id" : "2",
        "_score" : 0.0,
        "_source" : {
          "name" : "Susan Smith"
        }
      },
      {
        "_index" : "employee_nested_it",
        "_type" : "_doc",
        "_id" : "4",
        "_score" : 0.0,
        "_source" : {
          "name" : "John Doe"
        }
      }
    ]

Actual Result

    "hits" : [
      {
        "_index" : "employee_nested_it",
        "_type" : "_doc",
        "_id" : "1",
        "_score" : 0.0,
        "_source" : {
          "name" : "Bob Smith"
        }
      },
      {
        "_index" : "employee_nested_it",
        "_type" : "_doc",
        "_id" : "2",
        "_score" : 0.0,
        "_source" : {
          "name" : "Susan Smith"
        }
      },
      {
        "_index" : "employee_nested_it",
        "_type" : "_doc",
        "_id" : "3",
        "_score" : 0.0,
        "_source" : {
          "name" : "Jane Smith"
        }
      },
      {
        "_index" : "employee_nested_it",
        "_type" : "_doc",
        "_id" : "4",
        "_score" : 0.0,
        "_source" : {
          "name" : "John Doe"
        }
      }
    ]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant