search docs where fields match GET <host>:<port>/<index>/_search Body: { "query": { "bool": { "filter": { "script": { "script": "doc['field_a'].value == doc['field_b'].value" } } } } } search docs where fields match, and count them POST <host>:<port>/<index>/_search?size=0 { "query": { "bool": { "filter": { "script": { "script": "doc['field_a'].value == doc['field_b'].value" } } } }, "aggs": { "type_count": { "value_count": { "field" : "field_a" } } } } delete all docs using query POST <host>:<port>/<index>/_delete_by_query Body: { "query": { "bool": { "filter": { "script": { "script": "doc['field_a'].value == doc['field_b'].value" } } } } } count documents GET <host>:<port>/<index>/_count