GitHub user ddolzan opened a pull request:

    https://github.com/apache/flink/pull/2790

    [FLINK-4491] Handle index.number_of_shards in the ES connector

    Implemented the Index Template and Index Mapping creation. 
    Number of shards and many other properties can be defined in the Index 
Template.
    
    ### Usage
    Before calling ElasticasearchSink instantiate ElasticSearchHelper
    
    ```java
    ElasticSearchHelper esHelper = new ElasticSearchHelper(config, transports);
    //Create an Index Template given a name and the json structure
    esHelper.initTemplate(templateName, templateRequest);
    //Create an Index Mapping given the Index Name, DocType and the json 
structure
    esHelper.initIndexMapping(indexName, docType, mappingsRequest);
    ```
    
    ### TemplateRequest example
    ```json
    {
      "template": "te*",
      "settings": {
        "number_of_shards": 1
      },
      "mappings": {
        "type1": {
          "_source": {
            "enabled": false
          },
          "properties": {
            "host_name": {
              "type": "keyword"
            },
            "created_at": {
              "type": "date",
              "format": "EEE MMM dd HH:mm:ss Z YYYY"
            }
          }
        }
      }
    }
    ```
    ### MappingRequest example
    ```json
    {
      "mappings": {
        "user": {
          "_all": {
            "enabled": false
          },
          "properties": {
            "title": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "age": {
              "type": "integer"
            }
          }
        }
      }
    }
    ```
    
    
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ddolzan/flink issue-4491

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/2790.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2790
    
----
commit bae4237b755c1522a026ec691388ec8c197e8ab8
Author: ddolzan <[email protected]>
Date:   2016-11-11T15:21:05Z

    [FLINK-4491] Added index template and mappings creation

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to