ip_range works great, thanks for the suggestion. Term query on this works well.
Is full text search possible on ip_range fields ?
I have this mapping and text search failed on this ip-range. Wondering if there is solution to achieve this.
curl localhost:10201/ipindex/_mapping?pretty
{
"ipindex" : {
"mappings" : {
"_doc" : {
"properties" : {
"dst_ip" : {
"type" : "ip_range"
},
"src_ip" : {
"type" : "ip_range"
}
}
}
}
}
}
$ curl localhost:10201/ipindex/_search
{"took":2,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":1,"max_score":1.0,"hits":[{"_index":"ipindex","_type":"_doc","_id":"1","_score":1.0,"_source":{
"src_ip": "10.2.0.0/16",
"dst_ip": "10.3.0.128/29"
}
}]}}
$ curl localhost:10201/ipindex/_search?q=10.2.0.0
{"took":4,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},**"hits":{"total":0,"max_score":null,"hits":[]**}}
$ curl localhost:10201/ipindex/_search?q=src_ip:10.2.1.254
{"took":3,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":1,"max_score":1.0,"hits":[{"_index":"ipindex","_type":"_doc","_id":"1","_score":1.0,"_source":{
"src_ip": "10.2.0.0/16",
"dst_ip": "10.3.0.128/29"
}
}]}}