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

Add helpful message when ElasticsearchSink.Builder.build() throws an IllegalArgumentException.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.13.6
    • None
    • None

    Description

      When I test flink-connector-elasticsearch on my project. And I got an IllegalArgumentException with nothing helpful message. 

      Here's the exception message: 

       

      Exception in thread "main" java.lang.IllegalArgumentException
          at org.apache.flink.util.Preconditions.checkArgument(Preconditions.java:122)
          at org.apache.flink.streaming.connectors.elasticsearch7.Elasticsearch7ApiCallBridge.<init>(Elasticsearch7ApiCallBridge.java:61)
          at org.apache.flink.streaming.connectors.elasticsearch7.ElasticsearchSink.<init>(ElasticsearchSink.java:74)
          ... 

       

      I could not see which exactly the argument was illegal.

      After I read the code in (Elasticsearch7ApiCallBridge.java:61), I realized that proberbly  the ES hosts was empty. And finally fixed it.

      I think helpful message should be printed when such an important argument is illegal and fails to build the connector.

      And I'd love to improve it. thanks

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            kennywgx Kenny Wu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: