You could use the Lucene query syntax using the Query string query:
"query_string": {
"query": "account_id:128 AND city_id:256 AND (neighborhood_id:512 OR street_id:1024 AND (customer_active:true OR customer_new:true))"
}
or the Boolean equivalent I think is this:
"bool": {
"must": [{
"match": {
"account_id": "128"
}
}, {
"match": {
"city_id": "256"
}
}, {
"bool": {
"should": [{
"match": {
"neighborhood_id": "512"
}
}, {
"bool": {
"must": [{
"match": {
"street_id": "1024"
}
}, {
"bool": {
"should": [{
"match": {
"customer_active": "true"
}
}, {
"match": {
"customer_new": "true"
}
}]
}
}]
}
}]
}
}]
}