i'm trying to move some data to mongodb from elastic using elastic input plugin and csv ouput plugin and then mongoimport.
how can i define the fields types , including nested fields?
everything is showing up as strings in the csv output -> mongo
here is an example of _source data:
{
"id": "uf02fh-ch29ufh-hd289guf-hf92ui",
"platform": {
"description": "Chrome 90.0.4430.19 on OS X 10.14.6 64-bit",
"layout": "Blink",
"manufacturer": null,
"os": {
"architecture": 64,
"family": "OS X",
"version": "10.14.6"
}
},
"videos": [
{
"filename": "1.mpeg"
},
{
"filename": "2.mpeg"
}
],
"completed": false,
"createdAt": "2021-03-15T14:39:56.059Z",
"brightnessLevel": [
106.56687102472326
],
"gdprTimestamp": "2021-03-15T14:39:57.468Z",
"quality": "hd",
"updatedAt": "2021-03-15T14:40:53.147Z"
}
here is the conf file:
input {
elasticsearch {
hosts => "xxx:port"
user => "elastic"
password => "password"
index => "some_index"
query => '{
"query": { "match_all": {} },
"_source": ["id","platform","videos","completed","createdAt","brightnessLevel","gdprTimestamp","quality","updatedAt"]
}'
}
}
output {
csv {
# elastic field name
fields => ["id","platform","videos","completed","createdAt","brightnessLevel","gdprTimestamp","quality","updatedAt"]
# This is path where we store output.
path => "/tmp/csv-export.csv"
}
}