Skip to content

Instantly share code, notes, and snippets.

@phumberdroz
Created June 18, 2019 03:14
Show Gist options
  • Save phumberdroz/3ce355cc442532f51628065f2d570f24 to your computer and use it in GitHub Desktop.
Save phumberdroz/3ce355cc442532f51628065f2d570f24 to your computer and use it in GitHub Desktop.

create a pipeline to extract GEO Info from monitor.ip PUT _ingest/pipeline/

{
    "description": "Adds Geo Info to monitor.ip",
    "processors": [
        {
            "geoip": {
                "field": "monitor.ip",
                "target_field": "monitor.geo"
            }
        }
    ]
}

create a template so your new index will map monitor.geo.location as a geo_point (needed to display data on maps)

PUT _template/<template-name> 
{
    "index_patterns": [
        "heartbeat-*"
    ],
    "mappings": {
        "properties": {
            "monitor": {
                "properties": {
                    "geo": {
                        "properties": {
                            "location": {
                                "type": "geo_point"
                            }
                        }
                    }
                }
            }
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment