当前位置:   article > 正文

flink 写入到es_scala Flink读取kafka 写入es(elasticsearch) 简单实现

springboot整合flink kafka计算后存入elasticsearch

scala Flink读取kafka 写入elasticsearch 简单实现

引入pom依赖

es的Mapping

读取kafka 写入es 代码实现

scala 构建kafka生产者

scala 构建kafka消费者

引入pom依赖

org.apache.kafka

kafka_2.11

1.1.0

org.apache.kafka

kafka-clients

1.1.0

org.apache.flink

flink-connector-kafka_2.11

1.9.0

org.apache.flink

flink-connector-elasticsearch6_2.11

1.7.0

org.apache.flink

flink-streaming-scala_2.11

1.7.0

es的Mapping

{

"order": 0,

"index_patterns": [

"xiaojin_*"

],

"settings": {

"index": {

"number_of_shards": "3",

"translog": {

"flush_threshold_size": "1g"

},

"number_of_replicas": "1"

}

},

"mappings": {

"_default_": {

"dynamic_templates": [

{

"string_as_keyword": {

"mapping": {

"type": "keyword"

},

"match_mapping_type": "string",

"match": "*"

}

}

],

"_all": {

"enabled": false

},

"properties": {

"originalMsg": {

"index": false,

"type": "text"

},

"index": {

"index": false,

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/606406
推荐阅读
相关标签
  

闽ICP备14008679号