Hi Guy,
I am thinking of using an Elasticsearch query to display documents where the value of Field 1 equals Field 2. Does Elasticsearch support this type of query? If anyone knows, please provide me with more details. Thank you!
?
I think that the only way is by using a script query.
Can you provide me with an example query that displays documents where two fields, Field1
and Field2
, have the same value? thanks you
I did not test it but according to the doc, that should be something like:
GET /_search
{
"query": {
"bool": {
"filter": {
"script": {
"script": """
return (doc['Field1'].value == doc['Field2'].value);
"""
}
}
}
}
}
thks you.
"As far as I know, how does Logstash configure to follow a query containing a script in it? To trigger and retrieve the fields I need, if you know, please share with me.
Please ask your new question in Logstash
Is there a script to customize in an Elasticsearch query that can take field 1 from document 1 and compare it with the value of field 2 in document 2? Help me
Not really. That'd be "a join"... And Elasticsearch is not a relational DB.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.