Description
RANGE QUERY SCENARIO :
If I we have a doc which has IPs in form of an array like:
"ip":["192.168.0.0", "192.168.5.0", "192.168.10.0", "192.168.255.255"]
Now, If run a range IP query
{"field": "ip", "cidr": "192.168.0.0/16" |
It returns me the full doc as all IPs are within the desired range, even doc containing array value are also returned as expected!
This is because, the query would still return the doc as a hit because there is at least 1 IP token for the field that qualifies.
EXACT MATCH SCENARIO (BUGGY)
Now instead of range queries, and instead talking about direct/match queries.. Queries like:
{"field": "ip", "cidr": "172.16.0.0"} |
Only those docs are getting returned which have a direct match, doc containing array value are NOT returned.
We aren't going the same way with exact match as we are going in range queries.
Demo :
IP 172.16.0.0 present as an array of IP as well as an individual IP.
On querying the IP, we only get the docs which have an individual IP as doc value, IP present in arrays are not returned ( doc ip_52, ip_53) are not returned!