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

Elasticsearch Connector sample code for Scala on version 6.x will not work

    XMLWordPrintableJSON

Details

    Description

      The Scala example in the documentation for the Elasticsearch Connector, version 6.x, will not work. The class ElasticsearchSinkFunction[String] requires a RuntimeContext and a RequestIndexer, which the example omits.

      Also, type needs to be in inverse quotes as it's a Scala keyword.

      It should look like the following:

      def process(element: String, ctx: RuntimeContext, indexer: RequestIndexer) { 
         val json = new java.util.HashMap[String, String] 
         json.put("data", element) 
      
         val rqst: IndexRequest = Requests.indexRequest
            .index("testarindex")
            .`type`("_doc")
            .source(json) 
      
         indexer.add(rqst) 
      }

       

      Attachments

        Issue Links

          Activity

            People

              aromero Alberto Romero
              aromero Alberto Romero
              Votes:
              0 Vote for this issue
              Watchers:
              1 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