Elasticsearch is used in a lot of systems to collect and search logs such as Kibana (https://www.elastic.co/products/kibana) and LogStash (https://www.elastic.co/products/logstash). To improve search in these scenarios, it provides the IPv4 and IPv6 type that can be used to store IP address in an optimized way.
You need an up-and-running Elasticsearch installation as we described in the Downloading and installing Elasticsearch recipe in Chapter 2, Downloading and Setup.
You need to define the type of the field that contains IP address as ip
as follows:
Using the preceding order example, we can extend it adding the customer IP with:
"customer_ip": { "type": "ip", "store": "yes" }
The IP must be in the standard point notation form, that is:
"customer_ip":"19.18.200.201"