我尝试将 CSV 文件导入弹性文件,但失败并引发错误
Pipeline aborted due to error {:pipeline_id=>"main", :exception=>#, :backtrace=>["/usr/local/Cellar/logstash/7.6.1/libexec/vendor/bundle/jruby/2.5.0/gems/logstash-filter-mutate-3.5.0/lib/logstash/filters/mutate.rb:222:in
block in register'", "org/jruby/RubyHash.java:1428:in
each'", "/usr/local/Cellar/logstash/7.6.1/libexec/vendor/bundle/jruby/2.5.0/gems/logstash-filter-mutate-3.5.0/lib/logstash/filters/mutate.rb:220:inregister'", "org/logstash/config/ir/compiler/AbstractFilterDelegatorExt.java:56:in
register'", "/usr/local/Cellar/logstash/7.6.1/libexec/logstash-core/lib/logstash/java_pipeline.rb:200:inblock in register_plugins'", "org/jruby/RubyArray.java:1814:in
each'", "/usr/local/Cellar/logstash/7.6.1/libexec/logstash-core/lib/logstash/java_pipeline.rb:199:inregister_plugins'", "/usr/local/Cellar/logstash/7.6.1/libexec/logstash-core/lib/logstash/java_pipeline.rb:502:in
maybe_setup_out_plugins'", "/usr/local/Cellar/logstash/7.6.1/libexec/logstash-core/lib/logstash/java_pipeline.rb:212:instart_workers'", "/usr/local/Cellar/logstash/7.6.1/libexec/logstash-core/lib/logstash/java_pipeline.rb:154:in
run'", "/usr/local/Cellar/logstash/7.6.1/libexec/logstash-core/lib/logstash/java_pipeline.rb:109:in `block in start'"], "pipeline.sources"=>["/Users/user/Document/Esk-Data/xudaxia.conf"], :thread=>"#"}
下面是conf文件
input
{
file{
path => ["/test.csv"]
start_position => "beginning"
}
}
filter{
csv{
separator => ","
columns => ["comment_time","comment", "id", "video_time"]
}
mutate{
convert => {
"comment_time" => "date_time"
"comment" => "string"
"id" => "integer"
"video_time" => "float"
}
}
}
output{
elasticsearch{
hosts => ["localhost:9200"]
index => "test"
}
}
测试.csv
comment_time comment id video_time
2020/03/22 15:59:41 バイ a 123.100
2020/03/22 15:59:45 บาย b 100.100
2020/04/22 15:59:50 ByeBye c 80.210
有人可以帮忙吗?
最佳答案
根据文档,date_time
选项对于 mutate
插件的转换操作不存在 - doc here 。
然而,这个插件用于将一种类型转换为另一种类型,这不是您的用例。如果 comment_time
未被识别为日期字段,您应该使用 date
插件对其进行转换 - doc here .
所以你应该删除这个 block :
mutate{
convert => {
"comment_time" => "date_time"
"comment" => "string"
"id" => "integer"
"video_time" => "float"
}
}
并将其替换为以下内容:
date {
match => [ "comment_time", "yyyy/MM/dd HH:mm:ss"
}
关于java - 无法将 csv 数据加载到 Elasticsearch,翻译问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60902622/