简体   繁体   English

使用logstash jdbc将数组数据mysql加载到ElasticSearch

[英]load array data mysql to ElasticSearch using logstash jdbc

Hi i am new to ES and im trying to load data from 'MYSQL' to 'Elasticsearch' 嗨,我是ES新手,我正在尝试将数据从“ MYSQL”加载到“ Elasticsearch”

I am getting below error when trying to loadata in array format, any help 尝试以数组格式加载ata时出现以下错误,任何帮助

Here is mysql data, need array data for new & hex value columns 这是mysql数据,需要用于new和hex值列的数组数据

cid  color      new     hex      create            modified
1    100 euro   abcd   #86c67c  5/5/2016 15:48   5/13/2016 14:15
1    100 euro    1234   #fdf8ff  5/5/2016 15:48   5/13/2016 14:15

Here us the logstash config 这是我们的logstash配置

input {
 jdbc {
   jdbc_driver_library => "/etc/logstash/mysql/mysql-connector-java-5.1.39-bin.jar"
   jdbc_driver_class => "com.mysql.jdbc.Driver"
   jdbc_connection_string => "jdbc:mysql://127.0.0.1:3306/test"
   jdbc_user => "root"
   jdbc_password => "*****"
   schedule => "* * * * *"

   statement => "select cid,color, new as 'cvalue.new',hexa_value as 'cvalue.hexa',created,modified from colors_hex_test order by cid"
   jdbc_paging_enabled => "true"
   jdbc_page_size => "50000"
}
}

output {
    elasticsearch {
        index => "colors_hexa"
        document_type => "colors"
        document_id => "%{cid}"
        hosts => "localhost:9200"

Need array data for cvalue (new, hexa) like 需要数组数据的cvalue(new,hexa)喜欢

{
  "_index": "colors_hexa",
  "_type": "colors",
  "_id": "1",
  "_version": 218,
  "found": true,
  "_source": {
    "cid": 1,
    "color": "100 euro",
    "cvalue" : {
            "new": "1234",
            "hexa_value": "#fdf8ff",
        }
    "created": "2016-05-05T10:18:51.000Z",
    "modified": "2016-05-13T08:45:30.000Z",
    "@version": "1",
    "@timestamp": "2016-05-14T01:30:00.059Z"
  }
}

this is the error im getting while running logstash 这是运行logstash时出现的错误

 "status"=>400, "error"=>{"type"=>"mapper_parsing_exception",
 "reason"=>"Field name [cvalue.hexa] cannot contain '.'"}}}, :level=>:warn}

You cant give a field name with . 您不能使用输入字段名称. . But you can try to add: 但是您可以尝试添加:

filter {
  mutate {
    rename => { "new" => "[cvalue][new]" }
    rename => { "hexa" => "[cvalue][hexa]" }
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用JDBC驱动程序从ElasticSearch中的MySQL表加载动态数据 - load dynamic data from MySQL table in ElasticSearch using JDBC driver 使用Logstash将数据从mysql导入Elasticsearch - Import data from mysql to elasticsearch using logstash 如何使用logstash将Mysql数据迁移到elasticsearch - How to migrate Mysql data to elasticsearch using logstash Logstash 2.3.4 如何使用logstash-jdbc插件在elasticsearch中加载嵌套文档 - Logstash 2.3.4 How to load nested document in elasticsearch using logstash-jdbc plugin 使用Logstash JDBC插件在Elasticsearch中添加标签 - Add tags in Elasticsearch using logstash jdbc plugin 如何使用logstash将数据从AWS dynamo DB加载到Elasticsearch - How to Load data from AWS dynamo DB to Elasticsearch Using logstash 无法使用 Logstash 将数据从 CSV 加载到 Elasticsearch - Unable to Load data from CSV to Elasticsearch using Logstash 如何使用 logstash+jdbc 和数据库触发器对 Elasticsearch 进行增量加载 - How can I do incremental load into Elasticsearch using logstash+jdbc and Database Trigger elasticsearch jdbc river polling-反复从mysql加载数据 - elasticsearch jdbc river polling— load data from mysql repeatedly 使用logstash输入jdbc插件将从Mysql拉到Elasticsearch的Null值设置为默认值 - Set Null values pulled from Mysql to Elasticsearch to a default value using logstash input jdbc plugin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM