mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[TSVB] Series Filter (#14696)
- Add filter to timeseries config - Add filter to global series - Add test for series filter
This commit is contained in:
parent
a5f0f03f54
commit
53748044b0
4 changed files with 62 additions and 0 deletions
|
@ -60,6 +60,18 @@ export const SeriesConfig = props => {
|
|||
disabled={!model.override_index_pattern}
|
||||
/>
|
||||
</div>
|
||||
<div className="vis_editor__series_config-row">
|
||||
<label className="vis_editor__label" htmlFor={htmlId('series_filter')}>
|
||||
Filter
|
||||
</label>
|
||||
<input
|
||||
id={htmlId('series_filter')}
|
||||
className="vis_editor__input-grows"
|
||||
type="text"
|
||||
onChange={handleTextChange('filter')}
|
||||
value={model.filter}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -277,6 +277,18 @@ function TimeseriesConfig(props) {
|
|||
with-interval={true}
|
||||
/>
|
||||
</div>
|
||||
<div className="vis_editor__series_config-row">
|
||||
<label className="vis_editor__label" htmlFor={htmlId('series_filter')}>
|
||||
Filter
|
||||
</label>
|
||||
<input
|
||||
id={htmlId('series_filter')}
|
||||
className="vis_editor__input-grows"
|
||||
type="text"
|
||||
onChange={handleTextChange('filter')}
|
||||
value={model.filter}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -124,6 +124,35 @@ describe('query(req, panel, series)', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('returns doc with series filter', () => {
|
||||
series.filter = 'host:web-server';
|
||||
const next = doc => doc;
|
||||
const doc = query(req, panel, series)(next)({});
|
||||
expect(doc).to.eql({
|
||||
size: 0,
|
||||
query: {
|
||||
bool: {
|
||||
must: [
|
||||
{
|
||||
range: {
|
||||
timestamp: {
|
||||
gte: 1483228800000,
|
||||
lte: 1483232400000,
|
||||
format: 'epoch_millis'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
query_string: {
|
||||
query: series.filter,
|
||||
analyze_wildcard: true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
it('returns doc with panel filter and global', () => {
|
||||
req.payload.filters = [
|
||||
{
|
||||
|
|
|
@ -37,6 +37,15 @@ export default function query(req, panel, series) {
|
|||
});
|
||||
}
|
||||
|
||||
if (series.filter) {
|
||||
doc.query.bool.must.push({
|
||||
query_string: {
|
||||
query: series.filter,
|
||||
analyze_wildcard: true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return next(doc);
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue