[ 
https://issues.apache.org/jira/browse/FLINK-15400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17040786#comment-17040786
 ] 

Leonard Xu commented on FLINK-15400:
------------------------------------

Hi,[~ouyangwuli] .
 The design that issue description comes from blink  
([https://www.alibabacloud.com/help/faq-detail/94716.htm]) if I guess right.

I have an initial design which is more convenient than it after I looked up 
Spark 
support([https://www.elastic.co/guide/en/elasticsearch/hadoop/master/configuration.html#cfg-multi-writes])
 and blink both. 

{code:java}
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', 
# index value, this index value will  
# become Alias value   that mapping to all dynamic indies when 
#'connector.dynamicIndex' is configured. 
     
'connector.dynamicIndex'='my-log-{log_ts|yyyy-MM-dd}', 
# dynamic index value,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/bigint, 
# eg:'my-log-{log_ts|yyyy-MM-dd}'.
…)
{code}

If you‘re still work for this you can have a look.

BTW, I am glad to take over the rest work if you don't have  time:).

 

> elasticsearch sink support dynamic index.
> -----------------------------------------
>
>                 Key: FLINK-15400
>                 URL: https://issues.apache.org/jira/browse/FLINK-15400
>             Project: Flink
>          Issue Type: New Feature
>          Components: Connectors / ElasticSearch, Table SQL / Ecosystem
>    Affects Versions: 1.11.0
>            Reporter: ouyangwulin
>            Priority: Major
>              Labels: usability
>             Fix For: 1.11.0
>
>
> From 
> [email protected]([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|
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to