Last active
December 18, 2019 13:27
-
-
Save djptek/aee650185e882a7f373107d92d2fa5d1 to your computer and use it in GitHub Desktop.
script query equal properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT test_eq/_doc/test_pass | |
{ | |
"property1": "foo", | |
"property2": "foo" | |
} | |
PUT test_eq/_doc/test_fail | |
{ | |
"property1": "foo", | |
"property2": "bar" | |
} | |
GET test_eq/_search | |
{ | |
"query": { | |
"bool": { | |
"filter": { | |
"script": { | |
"script": { | |
"source": "doc['property1.keyword'].value == doc['property2.keyword'].value", | |
"lang": "painless" | |
} | |
} | |
} | |
} | |
} | |
} | |
##### shorter version | |
GET test_eq/_search | |
{ | |
"query": { | |
"script": { | |
"script": { | |
"source": "doc['property1.keyword'].value == doc['property2.keyword'].value", | |
"lang": "painless" | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment