Skip to content

Feature to specify ES pipeline for a given spreadsheet#86

Merged
codingchili merged 2 commits intocodingchili:masterfrom
octavioranieri:master
Nov 26, 2019
Merged

Feature to specify ES pipeline for a given spreadsheet#86
codingchili merged 2 commits intocodingchili:masterfrom
octavioranieri:master

Conversation

@octavioranieri
Copy link
Copy Markdown
Contributor

From #83
Implemented and tested, both web interface and CLI.

How to use it:

1-Create a ingest pipeline in your Elasticsearch:
Using Kibana:

PUT /_ingest/pipeline/pipeline-client-geolocation
{
  "processors": [
    {
      "uppercase": {
        "field": "country"
      }
    },
    {
      "geoip": {
        "field": "client_ip"
      }
    }
  ]
}

or cURL:

curl -XPUT "http://elasticsearch:9200/_ingest/pipeline/pipeline-client-geolocation" -H 'Content-Type: application/json' -d'{  "processors": [    {      "uppercase": {        "field": "country"      }    },    {      "geoip": {        "field": "client_ip"      }    }  ]}'

2- Specify pipeline name using web interface:
webinterface

Or using CLI:

java -jar ./excelastic-1.3.7.jar ./sample.xlsx clients --pipeline pipeline-client-geolocation

Sample with dummy data: sample.xlsx

3-Results of GET clients/_search:

{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 2,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "clients",
        "_type" : "default",
        "_id" : "FSK5pG4BQ_0-LmAn-QXS",
        "_score" : 1.0,
        "_source" : {
          "country" : "BRAZIL",
          "geoip" : {
            "continent_name" : "North America",
            "country_iso_code" : "US",
            "location" : {
              "lon" : -97.822,
              "lat" : 37.751
            }
          },
          "client_ip" : "8.8.8.8"
        }
      },
      {
        "_index" : "clients",
        "_type" : "default",
        "_id" : "FiK5pG4BQ_0-LmAn-QXS",
        "_score" : 1.0,
        "_source" : {
          "country" : "CANADA",
          "geoip" : {
            "continent_name" : "Oceania",
            "country_iso_code" : "AU",
            "location" : {
              "lon" : 143.2104,
              "lat" : -33.494
            }
          },
          "client_ip" : "1.1.1.1"
        }
      }
    ]
  }
}

If no pipeline is specified, import will proceed normally.

@octavioranieri octavioranieri mentioned this pull request Nov 25, 2019
@codingchili codingchili merged commit 1cbf8f9 into codingchili:master Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants