我用Logstash從https://www.kaggle.com/wcukierski/the-simpsons-by-the-data攝取CSV文件並將其保存到Elasticsearch。需要幫助識別被Elasticsearch攝入的文檔類型(通過Logstash)
input {
file {
path => "/Users/xyz/Downloads/the-simpsons-by-the-data/simpsons_characters.csv"
start_position => beginning
sincedb_path => "/dev/null"
}
}
filter {
csv {
columns => ["id", "name", "normalized_name", "gender"]
separator => ","
}
}
output {
stdout {
codec => rubydebug
}
elasticsearch {
hosts => "localhost"
action => "index"
index => "simpsons"
}
}
然而,當我查詢,像這樣:http://localhost:9200/simpsons/name/Lou
其中 simpsons = index
name = type
(我想...不知道)
我得到以下對於初學者來說,我用下面的conf攝入simpsons_characters.csv
迴應:
{
"_index": "simpsons",
"_type": "name",
"_id": "Lou",
"found": false
}
所以,問題是,爲什麼我沒有得到正確的答案。此外,當您通過csv進行批量攝取時,文檔的type
是什麼?
謝謝!
所以,我想,和它的作品。但是,那麼我該如何修改conf文件,而不是'logs'呢是'characters'呢?我猜如何設置'document_type'以便它不會默認爲'logs'?謝謝! – iyerland
您可以指定類似'document_type =>「字符」'。 –
是的:)我只是這樣做,它的工作!謝謝!將您的答案標記爲首選答案! – iyerland