I have a REST API call that returns the structure below. When I send this structure to Elasticsearch, all of the records within the "data" array are combined into one Elasticsearch document.
{
"data": [
{
"updateDate": "2017/12/13 19:53",
"id": "1234-ABCDE",
"title": "Foo",
"status": "ACTIVE",
"key": {
"number": 100,
"version": 2,
"year": 2017
}
},
{
"updateDate": "2017/12/14 10:22",
"id": "4567-EFGHI",
"title": "Bar",
"status": "INACTIVE",
"key": {
"number": 200,
"version": 5,
"year": 2018
}
},
]
}
My goal is to manipulate the data to the following output so each "data" element is put into its own Elasticsearch document.
{
"updateDate": "2017/12/13 19:53",
"id": "1234-ABCDE",
"title": "Foo",
"status": "ACTIVE",
"key": {
"number": 100,
"version": 2,
"year": 2017
}
},
{
"updateDate": "2017/12/14 10:22",
"id": "4567-EFGHI",
"title": "Bar",
"status": "INACTIVE",
"key": {
"number": 200,
"version": 5,
"year": 2018
}
}
Is this possible in a filter? I've used the SPLIT plugin to break out each "data" element into its own document, but that results in fields that are still nested under a "data" element like this:
{
"_index": "FOOBAR",
"_type": "doc",
"_id": "STdrPmIBPlj91gLKwYBv",
"_score": 1,
"_source": {
"data": {
"updateDate": "2017/12/13 19:53",
"id": "1234-ABCDE",
"title": "Foo",
"status": "ACTIVE",
"key": {
"number": 100,
"version": 2,
"year": 2017
}
},
"@version": "1",
"@timestamp": "2018-03-19T13:21:11.794Z"
}