I need a custom component for my Reactive Search setup. It will be a toggle button to filter for todays date. There will also be yesterday, and last week, but I'm just trying to get today working.
My Elastic Search index has a timeSubmitted
field that I would like to use. I am using the query produced when I search in Kibana. My code is below:
<ReactiveComponent
componentId="Today"
URLParams={true}
defaultQuery={() => ({
query: {
match: {
timeSubmitted: {
query: '2019-02-09',
type: 'phrase',
},
},
},
})}
>
<TodayComponent />
</ReactiveComponent>
class TodayComponent extends Component {
setValue() {
this.props.setQuery({
query: {
match: {
timeSubmitted: {
query: '2019-02-09',
type: 'phrase',
},
},
},
});
}
render() {
console.log('props', this.props);
return (
<button onClick={() => this.setValue()}>Today</button>
);
}
}
When I click the button, nothing happens at all.