I have a data collection with two fields y_hat
and y
.
I want to query it from elasticsearch where y_hat
is larger than y
value.
How do I do the query?
CodePudding user response:
You can use Script Query from Elasticsearch. Below query will return document only if field y_hat
value is grater then field y
value.
{
"query": {
"bool": {
"filter": {
"script": {
"script": """
return doc['y_hat'].value > doc['y'].value;
"""
}
}
}
}
}