-
Notifications
You must be signed in to change notification settings - Fork 84
[BUG] CSV reports will fail when a date field is an empty list #262
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersuntriagedv1.3.0
Description
Describe the bug
- Error message
{"statusCode":500,"error":"Internal Server Error","message":"Cannot read property '0' of undefined"}
For example
- mapping:
{
"test" : {
"mappings" : {
"properties" : {
"@timestamp" : {
"type" : "date"
},
"dates" : {
"type" : "date"
},
"message" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
}
}
}
- sample data
{
"_index" : "test",
"_type" : "_doc",
"_id" : "5",
"_score" : 1.0,
"_source" : {
"@timestamp" : "2021-12-17T14:03:21",
"message" : "first",
"dates" : [ ]
}
},
{
"_index" : "test",
"_type" : "_doc",
"_id" : "4",
"_score" : 1.0,
"_source" : {
"@timestamp" : "2021-12-17T14:03:21",
"message" : "first",
"dates" : [
"2021-12-17T14:04:55",
"2021-12-17T14:03:55"
]
}
},
Root cause
This code is causing the issue.
if (data._source[dateType]) will pass for an empty list, and failed the following logic. Need to put more restriction on this check. Also, for logic of parsing the only the first elements doesn't seem right. It should parse everything.
To Reproduce
Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior
A clear and concise description of what you expected to happen.
Plugins
Please list all plugins currently enabled.
Screenshots
If applicable, add screenshots to help explain your problem.
Host/Environment (please complete the following information):
- OS: [e.g. iOS]
- Version [e.g. 22]
Additional context
Add any other context about the problem here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersuntriagedv1.3.0
