Я хочу импортировать данные файла JSON в эластичный поиск.
вот мой конфигурационный файл logstash -
input {file {
type => "json"
path => "C: \ Users \ Desktop \ newJSON.json"
start_position => "begin" sincedb_path => "\ dev \ null"
}}
вывод {
stdout {
кодек => rubydebug
}
asticsearch {
hosts => "localhost: 9200"
index => "jsondata1"
}}
А вот мой файл json ---
{
"фрукты": "яблоко",
"маленький размер",
"красный цвет"
},
{
"фрукты": "папайя",
"размер": "большой",
"цвет": "желтый"
"тест": "сладкий"
}
я выполнил указанный выше файл конфигурации с помощью этой команды ----
logstash -f logstashcon.conf
но я получил данные, как показано ниже в упругом поисковом индексе -
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 10,
"max_score": 1,
"hits": [
{
"_index": "jsondata1",
"_type": "json",
"_id": "AWNniXbgMkzPgBTTablA",
"_score": 1,
"_source": {
"path": "C:\\Users\\Desktop\\newJSON.json",
"@timestamp": "2018-05-16T06:00:48.302Z",
"@version": "1",
"host": "user-102",
"message": "{\r",
"type": "json"
}
},
{
"_index": "jsondata1",
"_type": "json",
"_id": "AWNniXbgMkzPgBTTablB",
"_score": 1,
"_source": {
"path": "C:\\Users\\Desktop\\newJSON.json",
"@timestamp": "2018-05-16T06:00:48.694Z",
"@version": "1",
"host": "user-102",
"message": " \"fruit\": \"Apple\",\r",
"type": "json"
}
},
{
"_index": "jsondata1",
"_type": "json",
"_id": "AWNniXbgMkzPgBTTablE",
"_score": 1,
"_source": {
"path": "C:\\Users\\Desktop\\newJSON.json",
"@timestamp": "2018-05-16T06:00:48.696Z",
"@version": "1",
"host": "user-102",
"message": "},\r",
"type": "json"
}
},
{
"_index": "jsondata1",
"_type": "json",
"_id": "AWNniXbgMkzPgBTTablC",
"_score": 1,
"_source": {
"path": "C:\\Users\\Desktop\\newJSON.json",
"@timestamp": "2018-05-16T06:00:48.695Z",
"@version": "1",
"host": "user-102",
"message": " \"size\": \"Large\",\r",
"type": "json"
}
},
{
"_index": "jsondata1",
"_type": "json",
"_id": "AWNniXbgMkzPgBTTablD",
"_score": 1,
"_source": {
"path": "C:\\Users\\Desktop\\newJSON.json",
"@timestamp": "2018-05-16T06:00:48.696Z",
"@version": "1",
"host": "user-102",
"message": " \"color\": \"Red\"\r",
"type": "json"
}
},
{
"_index": "jsondata1",
"_type": "json",
"_id": "AWNniXbgMkzPgBTTablG",
"_score": 1,
"_source": {
"path": "C:\\Users\\Desktop\\newJSON.json",
"@timestamp": "2018-05-16T06:00:48.698Z",
"@version": "1",
"host": "user-102",
"message": "\"fruit\": \"Papaya\",\r",
"type": "json"
}
},
{
"_index": "jsondata1",
"_type": "json",
"_id": "AWNniXbgMkzPgBTTablJ",
"_score": 1,
"_source": {
"path": "C:\\Users\\Desktop\\newJSON.json",
"@timestamp": "2018-05-16T06:00:48.699Z",
"@version": "1",
"host": "user-102",
"message": "}\r",
"type": "json"
}
},
{
"_index": "jsondata1",
"_type": "json",
"_id": "AWNniXbgMkzPgBTTablH",
"_score": 1,
"_source": {
"path": "C:\\Users\\Desktop\\newJSON.json",
"@timestamp": "2018-05-16T06:00:48.699Z",
"@version": "1",
"host": "user-102",
"message": " \"size\": \"Large\",\r",
"type": "json"
}
},
{
"_index": "jsondata1",
"_type": "json",
"_id": "AWNniXbgMkzPgBTTablF",
"_score": 1,
"_source": {
"path": "C:\\Users\\Desktop\\newJSON.json",
"@timestamp": "2018-05-16T06:00:48.698Z",
"@version": "1",
"host": "user-102",
"message": "{\r",
"type": "json"
}
},
{
"_index": "jsondata1",
"_type": "json",
"_id": "AWNniXbgMkzPgBTTablI",
"_score": 1,
"_source": {
"path": "C:\\Users\\Desktop\\newJSON.json",
"@timestamp": "2018-05-16T06:00:48.699Z",
"@version": "1",
"host": "user-102",
"message": " \"color\": \"Yellow\"\r",
"type": "json"
}
}
]
}
}
Пожалуйста, помогите мне получить правильный вывод
Спасибо!