Date histogram brush - add range filter when field is not index pattern time field.#12286
Date histogram brush - add range filter when field is not index pattern time field.#12286nreese merged 5 commits intoelastic:masterfrom
Conversation
src/ui/public/utils/brush_event.js
Outdated
There was a problem hiding this comment.
Is the switch really necessary? What if we just moved the block from the switch statement into the body of this if statement? Seems like it could simplify this logic a bit.
lukasolson
left a comment
There was a problem hiding this comment.
Hmm, seems like there might be a lingering issue here. I've got a date field, creation_date, which is not my configured time field for the index pattern. Here's the mapping:
"creation_date": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss Z"
}When I create a bar chart with a date histogram on this field, then click on one of the bars, everything seems to work properly. However, when I brush on the chart, I get an error:
Is there any way we can mimic the behavior when creating a filter by clicking on the bar?
|
@lukasolson good find with the date parse error. I pushed a change that converts |
src/ui/public/utils/brush_event.js
Outdated
| if (max instanceof Date) { | ||
| max = max.getTime(); | ||
| } | ||
| const range = { gte: min, lt: max }; |
There was a problem hiding this comment.
I'm still getting the same error. You'll need to change this line to the following:
const range = { gte: min, lt: max, format: 'epoch_millis' };Then it will work 😄

fixes #3173
Modifies how brush events on
datefields are handled. When the field is the index pattern timefield, than the timefilter is updated. When the field is not the index pattern timefield, then the range filter is created.