Upload json file into elasticsearch

I want to upload a json file but it doesn t work, this is my config file :slight_smile:

input{
file{
type => "json"
path => "D:\Js.json"
start_position => "beginning"
sincedb_path => "/dev/null"
}
}
filter{

json{
	source => "message"
}

}
output{
elasticsearch{
hosts => "localhost:9200"
index => "xoxoxo"
document_type => "xoxoxofiles"
}
stdout{}
}

and this my json file :

{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}

Are you sure you want to use logstash for that?

yes , because my boss told me to upload 100 json files using logstash :frowning: what i should to use then !!!!!

curl in a shell script...
I mean that I'd not try to complicate things unless you need to do advanced transformations...

can we talke in a private using email ?? if its okey

Unless you want to share secret settings, I prefer keeping the discussion here as it can help the community and the community can also help.

This is the setting for Linux, but as it looks like you are using Windows it should probably be sincedb_path => "NUL" instead.

As your JSON object seems to span multiple lines, you will need to also use a multiline codec.

Recent version of Elasticsearch only support a single type per index, so you can probably remove this.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.