- I got a problem when I import csv file into elasticsearch
- here is my csv file looks like
name,age,sex
amy,18,girl
tom,19,boy
- and I use the default template in /etc/filebeat/filebeat.template.json which is below
{
"mappings": {
"default": {
"_all": {
"enabled": true,
"norms": {
"enabled": false
}
},
"dynamic_templates": [
{
"template1": {
"mapping": {
"doc_values": true,
"ignore_above": 1024,
"index": "not_analyzed",
"type": "{dynamic_type}"
},
"match": ""
}
}
],
"properties": {
"@timestamp": {
"type": "date"
},
"message": {
"type": "string",
"index": "analyzed"
},
"offset": {
"type": "long",
"doc_values": "true"
}
}
}
},
"settings": {
"index.refresh_interval": "5s"
},
"template": "filebeat-"
}
- the data I got in elasticseach was like
- message: "amy,18,girl"
- message:"tom,19,boy"
- I want to get the result like below
- {name: "amy", age: 18, sex: "girl"}
- {name: "tom", age: 19, sex: "boy"}
- So what should I config to get the result( just split the each line by comma when I import the csv file to elasticseach )