[ https://issues.apache.org/jira/browse/STORM-974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14698946#comment-14698946 ]
ASF GitHub Bot commented on STORM-974: -------------------------------------- Github user sweetest commented on a diff in the pull request: https://github.com/apache/storm/pull/679#discussion_r37155605 --- Diff: external/storm-elasticsearch/README.md --- @@ -6,37 +6,75 @@ ## EsIndexBolt (org.apache.storm.elasticsearch.bolt.EsIndexBolt) EsIndexBolt streams tuples directly into Elasticsearch. Tuples are indexed in specified index & type combination. -User should make sure that there are "source", "index","type", and "id" fields declared in preceding bolts or spout. -"index" and "type" fields are used for identifying target index and type. +Users should make sure that ```EsTupleMapper``` can extract "source", "index", "type", and "id" from input tuple. +"index" and "type" are used for identifying target index and type. "source" is a document in JSON format string that will be indexed in Elasticsearch. ```java +class SampleEsTupleMapper implements EsTupleMapper { + @Override + public String getSource(ITuple tuple) { + return tuple.getStringByField("source"); + } + + @Override + public String getIndex(ITuple tuple) { + return tuple.getStringByField("index"); + } + + @Override + public String getType(ITuple tuple) { + return tuple.getStringByField("type"); + } + + @Override + public String getId(ITuple tuple) { + return tuple.getStringByField("id"); + } +} + --- End diff -- How about naming this module as "DefaultEsTupleMapper"? > [storm-elasticsearch] Introduces Tuple -> ES document mapper to get rid of > constant field mapping (source, index, type) > ----------------------------------------------------------------------------------------------------------------------- > > Key: STORM-974 > URL: https://issues.apache.org/jira/browse/STORM-974 > Project: Apache Storm > Issue Type: Improvement > Reporter: Jungtaek Lim > Assignee: Jungtaek Lim > > For now EsIndexBolt uses constant field mapping (source, index, type) which > is not flexible. > We can introduce tuple -> ES document mapper interface to let users define > their relationship, as other external modules did. -- This message was sent by Atlassian JIRA (v6.3.4#6332)