GithubHelp home page GithubHelp logo

load-s3-to-es's Introduction

Load CSV data from Amazon S3 to Elasticsearch

This python script is used to load CSV files from Amazon S3 to Elasticsearch, weather self-managed or Amazon ES.

The script is tested on AWS Cloud9 and it is recommended to use Cloud9 for prevent data movement issue.

Prerequisites

  • Python 3.7+
  • Required packages
$ pip install -r requirements.txt
  • Permission to access S3 bucket (either IAM policy or bucket policy)

How To Use

  1. Setup config.json
{
    "s3": {
        "bucket": "",   // S3 bucket name
        "prefix": ""    // S3 prefix
    },
    "elasticsearch": {
        "url": [""],    // Elasticsearch URL
        "port": 443,    // Elasticsearch port
        "username": "", // Elasticsearch Username
        "password": ""  // Elasticsearch Password
    }
}
  1. Setup metadata.json
{
    "index": {
        "es_index_as_filename": false,  // if the value is false, filename will be index name.
        "es_index_name": "" // explicit index name, you have to set "es_index_as_filename" to false when using this field.
    },
    "data": {
        "headers": [], // field names, must be match with headers of csv file.
        "id_field": "" // field name that contain document id, if the value is "", UUID will be used.
    }
}
  1. Ensure that the first row of CSV data is field headers

  2. (Optional) Configure Elasticsearch Template for explicit define index mappings

  3. (Optional) Modify "bulk_batch_size" for tune bulk performance

How To Run

$ python s3-to-es.py

Elasticsearch Template

Kibana Dev Tool: Upload index template

POST _template/mytemplate
{Value of elasticsearch/es-template.json}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.