Skip to content

Elasticseach ingest processor to add Chinese region info based on provided ip address

License

Notifications You must be signed in to change notification settings

xloouis/elasticsearch-ingest-regionip

Repository files navigation

Elasticsearch regionip Ingest Processor

supported Elasticsearch verison: 6.2.4

Uses the ip2region lib to add Chinese region info based on provided ip address

Installation

  1. download .zip file
  2. use Elasticsearch elasticsearch-plugin command to install locally [reference]

Usage

PUT _ingest/pipeline/custom-pipeline-name
{
  "description": "custom description",
  "processors": [
    {
      "regionip": {
        "field": "field_containing_ip_address",
        "target_field": "target_field_name",
        "properties": ["country_name", "region_name", "city_name"]
      }
    }
  ]
}
target_field result example

"regionip": {
  "country_name": "中国",
  "city_name": "上海市",
  "region_name": "上海"
}
for more usage please refer to official doc

Configuration

conf required note
field yes Field name containing ip address
target_field no Field name to write region info to, defaults to regionip
ignore_missing no If set to true, doc missing specified field will not throw a exception, defaults to false.
ip2region_algorithm no BTREE/BINARY/MEMORY, defaults to MEMORY [link]
properties no ip, country_name, region_name, city_name, isp_name, defaults to all properties

Build

gradle clean assemble