Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] KQL in TSVB with full QueryBar #36175

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
435 commits
Select commit Hold shift + click to select a range
91cc695
refactors Split component
TinaHeiligers May 8, 2019
f9eb1d2
debugging
TinaHeiligers May 8, 2019
79fccf7
Fixes typo
TinaHeiligers May 8, 2019
a181fc0
Adds migration test for visualization migration 7.2.0
TinaHeiligers May 9, 2019
732b314
Fixes migration path to series and vis type check
TinaHeiligers May 9, 2019
858eb49
Adds test for migrating markdown saved objects
TinaHeiligers May 9, 2019
44ec874
Migrates split filter items
TinaHeiligers May 9, 2019
5c34602
Adds comments
TinaHeiligers May 9, 2019
03acbed
moves json fixtures to another file until I can clean them up
TinaHeiligers May 10, 2019
f0b3a1a
comments
TinaHeiligers May 10, 2019
858ba88
WIP1
TinaHeiligers Apr 23, 2019
f567f52
wip2
TinaHeiligers Apr 23, 2019
93800a1
Lucene query in QueryBar working within TSVB Panel Options tab
TinaHeiligers Apr 24, 2019
fbe93d1
Adds QueryBar to vis_types/timeseries/config filter
TinaHeiligers Apr 25, 2019
1f7763b
Uses collection change handler to update the model.query_string in th…
TinaHeiligers Apr 25, 2019
260dcbe
Replaces Text Input with Query bar in TSVB Data Group By Filter compo…
TinaHeiligers Apr 25, 2019
eb8f891
fetches index pattern objects for the VisEditor
TinaHeiligers Apr 26, 2019
883f908
Can't toggle QueryBar language toggle
TinaHeiligers Apr 26, 2019
0bd745d
Filters VisEditor IndexPatterns for the one selected, fixes relative …
TinaHeiligers Apr 28, 2019
03dfd70
adds commentts
TinaHeiligers Apr 29, 2019
65550c6
Gets KQL working in TSVB filter
TinaHeiligers Apr 29, 2019
d6a2391
Adds KQL to annotations in TSVB
TinaHeiligers Apr 29, 2019
b6dacf1
Gets suggestions working with KQL in timeseries.js
TinaHeiligers Apr 29, 2019
1bd979d
vis_types->timeseries->config WIP
TinaHeiligers Apr 30, 2019
8dccabc
refactors the filter label when split series is by filters
TinaHeiligers Apr 30, 2019
2214109
Enables suggestions in metrics group by filter aggregation
TinaHeiligers May 1, 2019
5559c56
Enables suggestions in Data tab -> Metrics tab -> Group by aggregatio…
TinaHeiligers May 1, 2019
6907004
Adds TODO checks
TinaHeiligers May 2, 2019
6066fbf
Adds suggestions to Data->Options query bar
TinaHeiligers May 2, 2019
f9a3342
Adds fetching indexPatterns for the QueryBar back to Split
TinaHeiligers May 2, 2019
6315041
adds index pattern back to Data->metrics
TinaHeiligers May 2, 2019
a508be1
Starts cleaning up method redefinitions
TinaHeiligers May 2, 2019
fb470fd
fixed props types for index pattern
TinaHeiligers May 2, 2019
b329935
deletes commented out refactored code
TinaHeiligers May 2, 2019
e815eab
Adds blue border markers for components that need to use the Querybar
TinaHeiligers May 3, 2019
8d09661
Adds QueryBar to TopN Panel Options Tab, renames screenName for Query…
TinaHeiligers May 3, 2019
842fbcd
Adds QueryBar to Gauge Panel Options Panel Filter
TinaHeiligers May 3, 2019
d74afeb
Adds QueryBar to Markdown Panel Options Panel Filter
TinaHeiligers May 3, 2019
7eed78b
Adds QueryBar to TSVB Table Panel Config Component, updates table req…
TinaHeiligers May 3, 2019
99c6458
Refactors table request processors to handle queries
TinaHeiligers May 3, 2019
57a90fe
Adds todo's to modify default filter initialization in components
TinaHeiligers May 3, 2019
55a057d
Deletes done TODO
TinaHeiligers May 6, 2019
cc20787
Changes default QueryBar query language from 'lucene' to 'kuery'
TinaHeiligers May 6, 2019
b0837f1
refactors Split component
TinaHeiligers May 8, 2019
b2c2026
debugging
TinaHeiligers May 8, 2019
f203d8c
Fixes typo
TinaHeiligers May 8, 2019
66897a4
Adds migration test for visualization migration 7.2.0
TinaHeiligers May 9, 2019
aa828a8
Fixes migration path to series and vis type check
TinaHeiligers May 9, 2019
4c3255e
Adds test for migrating markdown saved objects
TinaHeiligers May 9, 2019
47807fb
Migrates split filter items
TinaHeiligers May 9, 2019
92a11bf
Adds comments
TinaHeiligers May 9, 2019
e33aafd
moves json fixtures to another file until I can clean them up
TinaHeiligers May 10, 2019
386c59b
comments
TinaHeiligers May 10, 2019
dca9582
Visualization migration and tests update
TinaHeiligers May 10, 2019
6c71026
resets back to current
TinaHeiligers May 10, 2019
37f9eed
Fixes annotations editor query
TinaHeiligers May 11, 2019
e56e71a
Fixes timeseries
TinaHeiligers May 11, 2019
9cf8795
Adds default empty string to query.query passed into QueryBar
TinaHeiligers May 11, 2019
6e05cf8
Adds filter defaults to SplitByFilters
TinaHeiligers May 18, 2019
aeac349
Merge branch 'KQL_in_TSVL_rebased_May18_pm' into KQL_in_TSVB_rebased_…
TinaHeiligers May 19, 2019
7451c74
WIP1
TinaHeiligers Apr 23, 2019
aabdae8
wip2
TinaHeiligers Apr 23, 2019
095682e
Lucene query in QueryBar working within TSVB Panel Options tab
TinaHeiligers Apr 24, 2019
fa21b82
Adds QueryBar to vis_types/timeseries/config filter
TinaHeiligers Apr 25, 2019
f8d1ab2
Uses collection change handler to update the model.query_string in th…
TinaHeiligers Apr 25, 2019
8edfb85
Changes QueryBar appName and screenTitle in TSVB AnnotationsEditor
TinaHeiligers Apr 25, 2019
7bb7624
Replaces Text Input with Query bar in TSVB Data Group By Filter compo…
TinaHeiligers Apr 25, 2019
78d2065
fetches index pattern objects for the VisEditor
TinaHeiligers Apr 26, 2019
4844add
Can't toggle QueryBar language toggle
TinaHeiligers Apr 26, 2019
05c172c
Filters VisEditor IndexPatterns for the one selected, fixes relative …
TinaHeiligers Apr 28, 2019
152d385
adds commentts
TinaHeiligers Apr 29, 2019
a03811d
Gets KQL working in TSVB filter
TinaHeiligers Apr 29, 2019
dee2976
Adds KQL to annotations in TSVB
TinaHeiligers Apr 29, 2019
6ab7ad5
Gets suggestions working with KQL in timeseries.js
TinaHeiligers Apr 29, 2019
bd2856c
vis_types->timeseries->config WIP
TinaHeiligers Apr 30, 2019
2a1ff96
gets data->Options tab rendering again with QueryBar
TinaHeiligers Apr 30, 2019
25cc133
adds language to server side for series config filter
TinaHeiligers Apr 30, 2019
7101885
KQL selection in Group by Filter WIP
TinaHeiligers Apr 30, 2019
1cbbbb0
Updates server code for group by filter and filters
TinaHeiligers Apr 30, 2019
cbc552a
refactors the filter label when split series is by filters
TinaHeiligers Apr 30, 2019
a6f3852
Adds todo item
TinaHeiligers Apr 30, 2019
af18c73
updates import path to QueryBar post master rebase, adds filter query…
TinaHeiligers May 1, 2019
4a1b523
Enables suggestions in metrics group by filter aggregation
TinaHeiligers May 1, 2019
de30ba1
Enables suggestions in Data tab -> Metrics tab -> Group by aggregatio…
TinaHeiligers May 1, 2019
76542dd
Fixes Data->Options->model undefined issue again. This keeps repeatin…
TinaHeiligers May 2, 2019
ad76a31
Adds TODO checks
TinaHeiligers May 2, 2019
19823dc
Adds suggestions to Data->Options query bar
TinaHeiligers May 2, 2019
84a99ee
Adds fetching indexPatterns for the QueryBar back to Split
TinaHeiligers May 2, 2019
95f8218
adds index pattern back to Data->metrics
TinaHeiligers May 2, 2019
6ef7c01
Enables suggestions in annotations editor
TinaHeiligers May 2, 2019
e3fb407
Adds dragHandleProps back to Series props
TinaHeiligers May 2, 2019
ee42b3e
Starts cleaning up method redefinitions
TinaHeiligers May 2, 2019
9cc84d4
fixed props types for index pattern
TinaHeiligers May 2, 2019
bd38f1b
deletes commented out refactored code
TinaHeiligers May 2, 2019
ff80ff9
Adds blue border markers for components that need to use the Querybar
TinaHeiligers May 3, 2019
c42bcbf
Adds QueryBar to Metric Vis Panel Options tab
TinaHeiligers May 3, 2019
6c3c174
Adds QueryBar to TopN Panel Options Tab, renames screenName for Query…
TinaHeiligers May 3, 2019
1a8d00e
Adds QueryBar to Gauge Panel Options Panel Filter
TinaHeiligers May 3, 2019
0512268
Adds QueryBar to Markdown Panel Options Panel Filter
TinaHeiligers May 3, 2019
7aa69fc
Adds QueryBar to Table Panel Options Panel Filter
TinaHeiligers May 3, 2019
158070d
Adds QueryBar to TSVB Table Panel Config Component, updates table req…
TinaHeiligers May 3, 2019
126a31a
Refactors table request processors to handle queries
TinaHeiligers May 3, 2019
482e2e6
Cleans up server comments
TinaHeiligers May 3, 2019
5ebe572
Adds todo's to modify default filter initialization in components
TinaHeiligers May 3, 2019
72c1d14
Deletes done TODO
TinaHeiligers May 6, 2019
e9bac8f
Updates query test
TinaHeiligers May 6, 2019
67b8bc7
Updates split_by_filter test
TinaHeiligers May 6, 2019
eff318e
Updates split_by_filter test
TinaHeiligers May 6, 2019
0a1117c
updates split_by_filters to use the filter.filter, updates the test
TinaHeiligers May 6, 2019
2b02d16
Changes default QueryBar query language from 'lucene' to 'kuery'
TinaHeiligers May 6, 2019
29eab79
Uses uiSettings query language to set the default language in query s…
TinaHeiligers May 7, 2019
d77093b
Adds intl to QueryBar in split_filters
TinaHeiligers May 7, 2019
f80f04b
refactors Split component
TinaHeiligers May 8, 2019
a84620f
debugging
TinaHeiligers May 8, 2019
ac1dabb
Fixes typo
TinaHeiligers May 8, 2019
d70de92
Adds migration test for visualization migration 7.2.0
TinaHeiligers May 9, 2019
9f4ca6a
Fixes migration path to series and vis type check
TinaHeiligers May 9, 2019
ea99ba3
Adds test for migrating markdown saved objects
TinaHeiligers May 9, 2019
d377b37
Migrates split filter items
TinaHeiligers May 9, 2019
baa42e2
Adds comments
TinaHeiligers May 9, 2019
90cece1
moves json fixtures to another file until I can clean them up
TinaHeiligers May 10, 2019
bf765d6
comments
TinaHeiligers May 10, 2019
507e5af
WIP1
TinaHeiligers Apr 23, 2019
4cb4f1f
wip2
TinaHeiligers Apr 23, 2019
7be5cad
Lucene query in QueryBar working within TSVB Panel Options tab
TinaHeiligers Apr 24, 2019
7f36e73
Adds QueryBar to vis_types/timeseries/config filter
TinaHeiligers Apr 25, 2019
2823513
Uses collection change handler to update the model.query_string in th…
TinaHeiligers Apr 25, 2019
d630275
fetches index pattern objects for the VisEditor
TinaHeiligers Apr 26, 2019
56e0efb
Can't toggle QueryBar language toggle
TinaHeiligers Apr 26, 2019
fc0169e
Filters VisEditor IndexPatterns for the one selected, fixes relative …
TinaHeiligers Apr 28, 2019
af5c664
adds commentts
TinaHeiligers Apr 29, 2019
cf5abe0
Gets KQL working in TSVB filter
TinaHeiligers Apr 29, 2019
80e1c35
Adds KQL to annotations in TSVB
TinaHeiligers Apr 29, 2019
b53c351
Gets suggestions working with KQL in timeseries.js
TinaHeiligers Apr 29, 2019
ac54c23
vis_types->timeseries->config WIP
TinaHeiligers Apr 30, 2019
8932363
refactors the filter label when split series is by filters
TinaHeiligers Apr 30, 2019
0a77e79
Enables suggestions in metrics group by filter aggregation
TinaHeiligers May 1, 2019
12013a6
Enables suggestions in Data tab -> Metrics tab -> Group by aggregatio…
TinaHeiligers May 1, 2019
a51e1e4
Adds TODO checks
TinaHeiligers May 2, 2019
0d1851c
Adds suggestions to Data->Options query bar
TinaHeiligers May 2, 2019
cbc244d
Adds fetching indexPatterns for the QueryBar back to Split
TinaHeiligers May 2, 2019
e22b0cb
adds index pattern back to Data->metrics
TinaHeiligers May 2, 2019
a59520b
Starts cleaning up method redefinitions
TinaHeiligers May 2, 2019
baa092e
fixed props types for index pattern
TinaHeiligers May 2, 2019
6e375d2
deletes commented out refactored code
TinaHeiligers May 2, 2019
dedc6e8
Adds blue border markers for components that need to use the Querybar
TinaHeiligers May 3, 2019
f69f33c
Adds QueryBar to TopN Panel Options Tab, renames screenName for Query…
TinaHeiligers May 3, 2019
8a2b127
Adds QueryBar to Gauge Panel Options Panel Filter
TinaHeiligers May 3, 2019
121567f
Adds QueryBar to Markdown Panel Options Panel Filter
TinaHeiligers May 3, 2019
8ca25f9
Adds QueryBar to TSVB Table Panel Config Component, updates table req…
TinaHeiligers May 3, 2019
c9bc329
Refactors table request processors to handle queries
TinaHeiligers May 3, 2019
0db2e2d
Adds todo's to modify default filter initialization in components
TinaHeiligers May 3, 2019
22950f9
Deletes done TODO
TinaHeiligers May 6, 2019
d563422
Changes default QueryBar query language from 'lucene' to 'kuery'
TinaHeiligers May 6, 2019
e1654a9
refactors Split component
TinaHeiligers May 8, 2019
f7dec49
debugging
TinaHeiligers May 8, 2019
c6907a3
Fixes typo
TinaHeiligers May 8, 2019
0325e32
Fixes migration path to series and vis type check
TinaHeiligers May 9, 2019
11d8faf
Adds test for migrating markdown saved objects
TinaHeiligers May 9, 2019
5c2e4b2
Migrates split filter items
TinaHeiligers May 9, 2019
f395be5
Adds comments
TinaHeiligers May 9, 2019
87ac008
moves json fixtures to another file until I can clean them up
TinaHeiligers May 10, 2019
1e57258
comments
TinaHeiligers May 10, 2019
875f39d
Visualization migration and tests update
TinaHeiligers May 10, 2019
0dff873
resets back to current
TinaHeiligers May 10, 2019
8b6f99d
Fixes annotations editor query
TinaHeiligers May 11, 2019
fcb8c17
Fixes timeseries
TinaHeiligers May 11, 2019
6b9edbe
Adds default empty string to query.query passed into QueryBar
TinaHeiligers May 11, 2019
6630250
Adds filter defaults to SplitByFilters
TinaHeiligers May 18, 2019
b44f7ad
WIP1
TinaHeiligers Apr 23, 2019
06d9900
wip2
TinaHeiligers Apr 23, 2019
2befe81
Lucene query in QueryBar working within TSVB Panel Options tab
TinaHeiligers Apr 24, 2019
992acd5
Uses collection change handler to update the model.query_string in th…
TinaHeiligers Apr 25, 2019
0579195
Changes QueryBar appName and screenTitle in TSVB AnnotationsEditor
TinaHeiligers Apr 25, 2019
a1724d2
Replaces Text Input with Query bar in TSVB Data Group By Filter compo…
TinaHeiligers Apr 25, 2019
9cfc87a
fetches index pattern objects for the VisEditor
TinaHeiligers Apr 26, 2019
cfbe958
Can't toggle QueryBar language toggle
TinaHeiligers Apr 26, 2019
d134e0e
Filters VisEditor IndexPatterns for the one selected, fixes relative …
TinaHeiligers Apr 28, 2019
9100ec6
adds commentts
TinaHeiligers Apr 29, 2019
52aad1f
Gets KQL working in TSVB filter
TinaHeiligers Apr 29, 2019
d43ea72
Adds KQL to annotations in TSVB
TinaHeiligers Apr 29, 2019
fb3a25a
Gets suggestions working with KQL in timeseries.js
TinaHeiligers Apr 29, 2019
3367a35
vis_types->timeseries->config WIP
TinaHeiligers Apr 30, 2019
49a331f
gets data->Options tab rendering again with QueryBar
TinaHeiligers Apr 30, 2019
26a1c10
refactors the filter label when split series is by filters
TinaHeiligers Apr 30, 2019
d281604
Enables suggestions in metrics group by filter aggregation
TinaHeiligers May 1, 2019
d5e1869
Enables suggestions in Data tab -> Metrics tab -> Group by aggregatio…
TinaHeiligers May 1, 2019
27de4b2
Adds TODO checks
TinaHeiligers May 2, 2019
670200a
Adds suggestions to Data->Options query bar
TinaHeiligers May 2, 2019
b1daf25
Adds fetching indexPatterns for the QueryBar back to Split
TinaHeiligers May 2, 2019
a8fb546
adds index pattern back to Data->metrics
TinaHeiligers May 2, 2019
f7e7830
Starts cleaning up method redefinitions
TinaHeiligers May 2, 2019
9653ec5
deletes commented out refactored code
TinaHeiligers May 2, 2019
68f771b
Adds blue border markers for components that need to use the Querybar
TinaHeiligers May 3, 2019
862778f
Adds QueryBar to TopN Panel Options Tab, renames screenName for Query…
TinaHeiligers May 3, 2019
bc7505b
Adds QueryBar to Gauge Panel Options Panel Filter
TinaHeiligers May 3, 2019
8f9a71d
Adds QueryBar to Markdown Panel Options Panel Filter
TinaHeiligers May 3, 2019
09ecfa7
Adds QueryBar to TSVB Table Panel Config Component, updates table req…
TinaHeiligers May 3, 2019
1b527d3
Refactors table request processors to handle queries
TinaHeiligers May 3, 2019
f724e0f
Adds todo's to modify default filter initialization in components
TinaHeiligers May 3, 2019
df404fe
Deletes done TODO
TinaHeiligers May 6, 2019
541b72b
Changes default QueryBar query language from 'lucene' to 'kuery'
TinaHeiligers May 6, 2019
4dbf319
Uses uiSettings query language to set the default language in query s…
TinaHeiligers May 7, 2019
11b3ab1
debugging
TinaHeiligers May 8, 2019
4c636f0
Fixes typo
TinaHeiligers May 8, 2019
c73ef19
Migrates split filter items
TinaHeiligers May 9, 2019
5075fff
Adds comments
TinaHeiligers May 9, 2019
f41b196
moves json fixtures to another file until I can clean them up
TinaHeiligers May 10, 2019
9288c21
WIP1
TinaHeiligers Apr 23, 2019
4b40d75
wip2
TinaHeiligers Apr 23, 2019
523d466
Lucene query in QueryBar working within TSVB Panel Options tab
TinaHeiligers Apr 24, 2019
ff83d6a
Adds QueryBar to vis_types/timeseries/config filter
TinaHeiligers Apr 25, 2019
435367f
Uses collection change handler to update the model.query_string in th…
TinaHeiligers Apr 25, 2019
32d3509
Replaces Text Input with Query bar in TSVB Data Group By Filter compo…
TinaHeiligers Apr 25, 2019
63b35be
fetches index pattern objects for the VisEditor
TinaHeiligers Apr 26, 2019
14566c1
Can't toggle QueryBar language toggle
TinaHeiligers Apr 26, 2019
5708fe7
Filters VisEditor IndexPatterns for the one selected, fixes relative …
TinaHeiligers Apr 28, 2019
95010c5
adds commentts
TinaHeiligers Apr 29, 2019
d0e0626
Gets KQL working in TSVB filter
TinaHeiligers Apr 29, 2019
2018550
Adds KQL to annotations in TSVB
TinaHeiligers Apr 29, 2019
5adfeb5
Gets suggestions working with KQL in timeseries.js
TinaHeiligers Apr 29, 2019
a117dbe
vis_types->timeseries->config WIP
TinaHeiligers Apr 30, 2019
07e5921
refactors the filter label when split series is by filters
TinaHeiligers Apr 30, 2019
bd85837
Enables suggestions in metrics group by filter aggregation
TinaHeiligers May 1, 2019
9b59d17
Enables suggestions in Data tab -> Metrics tab -> Group by aggregatio…
TinaHeiligers May 1, 2019
a8554af
Adds TODO checks
TinaHeiligers May 2, 2019
be77d25
Adds suggestions to Data->Options query bar
TinaHeiligers May 2, 2019
381e40f
Adds fetching indexPatterns for the QueryBar back to Split
TinaHeiligers May 2, 2019
7d1f8a6
adds index pattern back to Data->metrics
TinaHeiligers May 2, 2019
cc29420
Starts cleaning up method redefinitions
TinaHeiligers May 2, 2019
4c1dac2
fixed props types for index pattern
TinaHeiligers May 2, 2019
256f6f0
deletes commented out refactored code
TinaHeiligers May 2, 2019
8e485fc
Adds blue border markers for components that need to use the Querybar
TinaHeiligers May 3, 2019
db7fea0
Adds QueryBar to TopN Panel Options Tab, renames screenName for Query…
TinaHeiligers May 3, 2019
0cba967
Adds QueryBar to Gauge Panel Options Panel Filter
TinaHeiligers May 3, 2019
526ba78
Adds QueryBar to Markdown Panel Options Panel Filter
TinaHeiligers May 3, 2019
d50d37b
Adds QueryBar to TSVB Table Panel Config Component, updates table req…
TinaHeiligers May 3, 2019
652e578
Refactors table request processors to handle queries
TinaHeiligers May 3, 2019
4aaa5a8
Adds todo's to modify default filter initialization in components
TinaHeiligers May 3, 2019
e7042af
Deletes done TODO
TinaHeiligers May 6, 2019
9e53eae
Changes default QueryBar query language from 'lucene' to 'kuery'
TinaHeiligers May 6, 2019
1dede25
refactors Split component
TinaHeiligers May 8, 2019
29fdbc1
debugging
TinaHeiligers May 8, 2019
113340e
Fixes typo
TinaHeiligers May 8, 2019
3bed3b1
Adds migration test for visualization migration 7.2.0
TinaHeiligers May 9, 2019
76de27b
Migrates split filter items
TinaHeiligers May 9, 2019
141b1ec
Adds comments
TinaHeiligers May 9, 2019
f38aa1b
Visualization migration and tests update
TinaHeiligers May 10, 2019
7057264
Fixes timeseries
TinaHeiligers May 11, 2019
4aad263
Merge branch 'temp-rebase' into KQL_in_TSVB_rebased_May6_am
TinaHeiligers May 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import { once } from 'lodash';
import { QueryBar } from './components/query_bar';
import { QueryBarInput } from './components/query_bar_input';
import { fromUser } from './lib/from_user';
import { toUser } from './lib/to_user';

Expand All @@ -40,6 +41,7 @@ export class QueryBarService {
},
ui: {
QueryBar,
QueryBarInput,
},
};
}
Expand Down
204 changes: 204 additions & 0 deletions src/legacy/core_plugins/kibana/fixtures.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/


export const fixtures = {
doc: {
attributes: {
visState: JSON.stringify({
title: 'Filter Bytes Test: tsvb metric with custom interval and bytes filter',
type: 'metrics',
params: {
id: '61ca57f0-469d-11e7-af02-69e470af7417',
type: 'metric',
series: [
{
id: '1',
color: '#68BC00',
split_mode: 'everything',
metrics: [
{
value: '',
id: '61ca57f2-469d-11e7-af02-69e470af7417',
type: 'sum',
field: 'bytes'
}
],
filter: 'Filter Bytes Test:>1000',
},
{
id: '2',
color: '#68BC00',
split_mode: 'everything',
metrics: [
{
value: '',
id: '61ca57f2-469d-11e7-af02-69e470af7417',
type: 'sum',
field: 'bytes'
}
],
filter: {
query: 'Filter Bytes Test:>1000',
language: 'lucene'
},
},
{
id: '3',
color: '#68BC00',
split_mode: 'everything',
metrics: [
{
value: '',
id: '61ca57f2-469d-11e7-af02-69e470af7417',
type: 'sum',
field: 'bytes'
}
]
}
],
time_field: '@timestamp',
index_pattern: 'logstash-*',
interval: 'auto',
axis_position: 'left',
axis_formatter: 'number',
show_legend: 1,
show_grid: 1,
background_color_rules: [{ 'id': '1' }]
},
aggs: []
})
},
},
doc2: {
attributes: {
visState: JSON.stringify({
title: 'Arbitrary table',
type: 'table',
params: {
id: '61ca57f0-469d-11e7-af02-69e470af7417',
type: 'metric',
series: [
{
id: '1',
color: '#68BC00',
split_mode: 'everything',
metrics: [
{
value: '',
id: '61ca57f2-469d-11e7-af02-69e470af7417',
type: 'sum',
field: 'bytes'
}
],
filter: '',
}
],
time_field: '@timestamp',
index_pattern: 'logstash-*',
interval: 'auto',
axis_position: 'left',
axis_formatter: 'number',
show_legend: 1,
show_grid: 1,
background_color_rules: [{ 'id': '1' }]
},
aggs: []
})
},
},
doc3: {
id: '3',
type: 'visualization',
attributes: {
description: '',
kibanaSavedObjectMeta: {
searchSourceJSON: '{}'
},
title: 'Filter Bytes Test: tsvb markdown',
uiStateJSON: '{}',
version: 1,
visState: JSON.stringify({
title: 'Filter Bytes Test: tsvb markdown',
type: 'metrics',
params: {
id: '61ca57f0-469d-11e7-af02-69e470af7417',
type: 'markdown',
series: [
{
id: '61ca57f1-469d-11e7-af02-69e470af7417',
color: '#68BC00',
split_mode: 'filters',
metrics: [
{
id: '482d6560-4194-11e8-a461-7d278185cba4',
type: 'avg',
field: 'bytes'
}
],
seperate_axis: 0,
axis_position: 'right',
formatter: 'number',
chart_type: 'line',
line_width: 1,
point_size: 1,
fill: 0.5,
stacked: 'none',
terms_field: 'clientip',
filter: 'Filter Bytes Test:>1000',
override_index_pattern: 0,
series_index_pattern: 'logstash-*',
series_time_field: 'utc_time',
series_interval: '1m',
value_template: '',
split_filters: [
{
filter: 'bytes:>1000',
label: '',
color: '#68BC00',
id: '39a107e0-4194-11e8-a461-7d278185cba4'
}
],
label: '',
var_name: ''
}
],
time_field: '@timestamp',
index_pattern: 'logstash-*',
interval: 'auto',
axis_position: 'left',
axis_formatter: 'number',
show_legend: 1,
show_grid: 1,
background_color_rules: [
{
id: '06893260-4194-11e8-a461-7d278185cba4'
}
],
bar_color_rules: [
{
id: '36a0e740-4194-11e8-a461-7d278185cba4'
}
],
markdown: '{{bytes_1000.last.formatted}}'
}
})
}
}
};
95 changes: 94 additions & 1 deletion src/legacy/core_plugins/kibana/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,98 @@ const migrateDateHistogramAggregation = doc => {
return doc;
};

// Migrate filters (string -> { query: string, language: lucene })
/*
Enabling KQL in TSVB causes problems with savedObject visualizations when these are saved with filters.
In a visualisation type of saved object, if the visState param is of type metric, the filter is saved as a string that is not interpretted correctly as a lucene query in the visualization itself.
We need to transform the filter string into an object containing the original string as a query and specify the query language as lucene.
For Metrics visualizations (param.type === "metric"), filters can be applied to each series object in the series array within the SavedObject.visState.params object.
Path to the series array is thus:
attributes.visState.
*/
function transformFilterStringToQueryObject(doc) {
// Migrate filters
// If any filters exist and they are a string, we assume it to be lucene and transform the filter into an object accordingly
const newDoc = cloneDeep(doc);
const visStateJSON = get(doc, 'attributes.visState');
if (visStateJSON) {
let visState;
try {
visState = JSON.parse(visStateJSON);
} catch (e) {
// let it go, the data is invalid and we'll leave it as is
}
if (visState) {
const visType = get(visState, 'params.type');
const tsvbTypes = ['metric', 'markdown', 'top_n', 'gauge', 'table', 'timeseries'];
if (tsvbTypes.indexOf(visType) === -1) {
// skip
return doc;
}
// migrate the params fitler
const params = get(visState, 'params');
if (params.filter && typeof params.filter === 'string') {
const paramsFilterObject = {
query: params.filter,
language: 'lucene',
};
params.filter = paramsFilterObject;
}

// migrate the annotations query string:
const annotations = get(visState, 'params.annotations') || [];
annotations.forEach((item) => {
if (!item.query_string) {
// we don't need to transform anything if there isn't a filter at all
return;
}
if (typeof item.query_string === 'string') {
const itemQueryStringObject = {
query: item.query_string,
language: 'lucene',
};
item.query_string = itemQueryStringObject;
}
});
// migrate the series filters
const series = get(visState, 'params.series') || [];
series.forEach((item) => {
if (!item.filter) {
// we don't need to transform anything if there isn't a filter at all
return;
}
// series item filter
if (typeof item.filter === 'string') {
const itemfilterObject = {
query: item.filter,
language: 'lucene',
};
item.filter = itemfilterObject;
}
// series item split filters filter
if (item.split_filters) {
const splitFilters = get(item, 'split_filters') || [];
splitFilters.forEach((filter) => {
if (!filter.filter) {
// we don't need to transform anything if there isn't a filter at all
return;
}
if (typeof filter.filter === 'string') {
const filterfilterObject = {
query: filter.filter,
language: 'lucene',
};
filter.filter = filterfilterObject;
}
});
}
});
newDoc.attributes.visState = JSON.stringify(visState);
}
}
return newDoc;
}

const executeMigrations710 = flow(migratePercentileRankAggregation, migrateDateHistogramAggregation);

function removeDateHistogramTimeZones(doc) {
Expand Down Expand Up @@ -264,7 +356,8 @@ export const migrations = {
}
},
'7.0.1': removeDateHistogramTimeZones,
'7.1.0': doc => executeMigrations710(doc)
'7.1.0': doc => executeMigrations710(doc),
'7.2.0': transformFilterStringToQueryObject
},
dashboard: {
'7.0.0': (doc) => {
Expand Down
Loading