Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-15400

elasticsearch sink support dynamic index.

    XMLWordPrintableJSON

Details

    Description

      From user-zh@flink.apache.org(https://lists.apache.org/thread.html/ac4e0c068baeb3b070f0213a2e1314e6552b226b8132a4c49d667ecd%40%3Cuser-zh.flink.apache.org%3E),  Becuase the es 6/7 not support ttl. so User need clean the index by timestamp. Add dynamic index is a useful function.  Add with properties 'dynamicIndex' as a switch for open dynamicIndex. Add with  properties 'indexField'  for the extract time field, Add properties 'indexInterval' for change cycle mode.

       

      With property discribe default Required
      dynamicIndex Dynamic or not false(true/false) false
      indexField extract index field  none dynamicIndex is true , then indexField is required,only supported type "timestamp","date","long" 
      indexInterval mode for  cycle d ddynamicIndex is true , this field is required ,the value optional is:
      d:day
      m:mouth
      w:week

       

      After discussion, the final design looks as following :

      CREATE TABLE es_sink_table (
        log_source varchar ,
        log_content varchar ,
        log_level bigint ,
        log_ts timestamp,
      ) WITH (
      'connector.type' = 'elasticsearch',
      'connector.version' = '6',
      'connector.index'='my-log-{log_ts|yyyy-MM-dd}', 
      # elasticsearch index name, Flink support create index based on field at 
      # runtime dynamically, the index value comes from the dynamicIndex 
      # pattern when the field type is varchar, eg:'my-log-{log_source}',the # dynamicIndex pattern support format and parse date by Java 
      # SimpleDataFormat when the field type is timestamp/date, 
      # eg:'my-log-{log_ts|yyyy-MM-dd}'.
      'connector.index-alias'='my-log',       
      # index alias name, the alias name mapping to all indies that 
      # creatd from 'connector.index'. 
      …
      )
      

       

       

       

      Attachments

        Issue Links

          Activity

            People

              leonard Leonard Xu
              ouyangwuli ouyangwulin
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m