[ 
https://issues.apache.org/jira/browse/FLINK-18432?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

rinkako closed FLINK-18432.
---------------------------
    Fix Version/s: 1.12.0
       Resolution: Duplicate

> add open and close methods for ElasticsearchSinkFunction interface
> ------------------------------------------------------------------
>
>                 Key: FLINK-18432
>                 URL: https://issues.apache.org/jira/browse/FLINK-18432
>             Project: Flink
>          Issue Type: Improvement
>          Components: Connectors / ElasticSearch
>            Reporter: rinkako
>            Priority: Major
>              Labels: usability
>             Fix For: 1.12.0
>
>
> Here comes a example story: we want to sink data to ES with a day-rolling 
> index name, by using `DateTimeFormatter` and `ZonedDateTime` for generating a 
> day-rolling postfix to add to the index pattern of `return 
> Requests.indexRequest().index("mydoc_"+postfix)` in a custom 
> `ElasticsearchSinkFunction`. Here `DateTimeFormatter` is not a serializable 
> class and must be a transient field of this `ElasticsearchSinkFunction`, and 
> it must be checked null every time we call `process` (since the field is 
> transient, it may be null at a distributed task manager), which can be done 
> at a `open` method only run once.
> So it seems that add `open` and `close` method of `ElasticsearchSinkFunction` 
> interface can handle this well, users can control their sink function 
> life-cycle more flexiblely. And, for compatibility, this two methods may have 
> a empty default implementation at `ElasticsearchSinkFunction` interface.



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

Reply via email to