The sql query is equivalent to:
{
"query": {
"bool": {
"must": [
{
"term": {
"field1": "X"
}
},
{
"term": {
"field3": "Z"
}
}
],
"must_not": {
"term": {
"field2": "Y"
}
}
}
}
}
In any case I recommend you to read a bit the doc before starting with elasticsearch if you are new.
There are lots of types of queries and some of them depends on how you index your data, for example for strings, you can analyze strings (lowercase, stem words, remove stopwords, …) at index time. The query I posted will never match a doc whose field1 is “X” if you analyze that field at index time and convert it to lower case.
Once you know a little bit better elasticsearch you can use filters for improving your queries.