diff --git a/api_docs/data.json b/api_docs/data.json index 612b911915f9d..7989768e180ce 100644 --- a/api_docs/data.json +++ b/api_docs/data.json @@ -23950,37 +23950,6 @@ "returnComment": [], "initialIsOpen": false }, - { - "id": "def-common.doesKueryExpressionHaveLuceneSyntaxError", - "type": "Function", - "children": [ - { - "type": "Any", - "label": "expression", - "isRequired": true, - "signature": [ - "any" - ], - "description": [], - "source": { - "path": "src/plugins/data/common/es_query/kuery/ast/ast.ts", - "lineNumber": 60 - } - } - ], - "signature": [ - "(expression: any) => boolean" - ], - "description": [], - "label": "doesKueryExpressionHaveLuceneSyntaxError", - "source": { - "path": "src/plugins/data/common/es_query/kuery/ast/ast.ts", - "lineNumber": 59 - }, - "tags": [], - "returnComment": [], - "initialIsOpen": false - }, { "id": "def-common.enableFilter", "type": "Function", @@ -25761,7 +25730,7 @@ "description": [], "source": { "path": "src/plugins/data/common/es_query/kuery/ast/ast.ts", - "lineNumber": 78 + "lineNumber": 67 } }, { @@ -25781,7 +25750,7 @@ "description": [], "source": { "path": "src/plugins/data/common/es_query/kuery/ast/ast.ts", - "lineNumber": 79 + "lineNumber": 68 } }, { @@ -25794,7 +25763,7 @@ "description": [], "source": { "path": "src/plugins/data/common/es_query/kuery/ast/ast.ts", - "lineNumber": 80 + "lineNumber": 69 } }, { @@ -25807,7 +25776,7 @@ "description": [], "source": { "path": "src/plugins/data/common/es_query/kuery/ast/ast.ts", - "lineNumber": 81 + "lineNumber": 70 } } ], @@ -25841,7 +25810,7 @@ "label": "toElasticsearchQuery", "source": { "path": "src/plugins/data/common/es_query/kuery/ast/ast.ts", - "lineNumber": 77 + "lineNumber": 66 }, "tags": [ "params" @@ -26395,17 +26364,6 @@ "lineNumber": 23 } }, - { - "tags": [], - "id": "def-common.KueryParseOptions.errorOnLuceneSyntax", - "type": "boolean", - "label": "errorOnLuceneSyntax", - "description": [], - "source": { - "path": "src/plugins/data/common/es_query/kuery/types.ts", - "lineNumber": 24 - } - }, { "tags": [], "id": "def-common.KueryParseOptions.cursorSymbol", @@ -26414,7 +26372,7 @@ "description": [], "source": { "path": "src/plugins/data/common/es_query/kuery/types.ts", - "lineNumber": 25 + "lineNumber": 24 }, "signature": [ "string | undefined" @@ -26428,7 +26386,7 @@ "description": [], "source": { "path": "src/plugins/data/common/es_query/kuery/types.ts", - "lineNumber": 26 + "lineNumber": 25 }, "signature": [ "boolean | undefined" diff --git a/api_docs/ml.json b/api_docs/ml.json index f626cf8dc3ba0..3a3463b7397e2 100644 --- a/api_docs/ml.json +++ b/api_docs/ml.json @@ -546,7 +546,7 @@ "description": [], "source": { "path": "x-pack/plugins/ml/common/types/modules.ts", - "lineNumber": 80 + "lineNumber": 94 }, "signature": [ { @@ -567,7 +567,7 @@ "description": [], "source": { "path": "x-pack/plugins/ml/common/types/modules.ts", - "lineNumber": 81 + "lineNumber": 95 }, "signature": [ { @@ -588,7 +588,7 @@ "description": [], "source": { "path": "x-pack/plugins/ml/common/types/modules.ts", - "lineNumber": 82 + "lineNumber": 96 }, "signature": [ "{ search: ", @@ -621,7 +621,7 @@ ], "source": { "path": "x-pack/plugins/ml/common/types/modules.ts", - "lineNumber": 79 + "lineNumber": 93 }, "initialIsOpen": false }, diff --git a/api_docs/saved_objects.json b/api_docs/saved_objects.json index e4b71b23a047e..a3bc4b059c712 100644 --- a/api_docs/saved_objects.json +++ b/api_docs/saved_objects.json @@ -220,11 +220,11 @@ { "id": "def-public.SavedObjectLoader", "type": "Class", - "tags": [], - "label": "SavedObjectLoader", - "description": [ - "\nThe SavedObjectLoader class provides some convenience functions\nto load and save one kind of saved objects (specified in the constructor).\n\nIt is based on the SavedObjectClient which implements loading and saving\nin an abstract, type-agnostic way. If possible, use SavedObjectClient directly\nto avoid pulling in extra functionality which isn't used." + "tags": [ + "deprecated" ], + "label": "SavedObjectLoader", + "description": [], "children": [ { "tags": [], @@ -234,7 +234,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 34 + "lineNumber": 35 } }, { @@ -245,7 +245,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 35 + "lineNumber": 36 } }, { @@ -256,7 +256,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 36 + "lineNumber": 37 }, "signature": [ "Record" @@ -281,7 +281,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 39 + "lineNumber": 40 } }, { @@ -302,7 +302,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 40 + "lineNumber": 41 } } ], @@ -310,7 +310,7 @@ "returnComment": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 38 + "lineNumber": 39 } }, { @@ -334,7 +334,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 60 + "lineNumber": 61 } } ], @@ -342,7 +342,7 @@ "returnComment": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 60 + "lineNumber": 61 } }, { @@ -364,7 +364,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 68 + "lineNumber": 69 } } ], @@ -372,7 +372,7 @@ "returnComment": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 68 + "lineNumber": 69 } }, { @@ -394,7 +394,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 72 + "lineNumber": 73 } } ], @@ -402,7 +402,7 @@ "returnComment": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 72 + "lineNumber": 73 } }, { @@ -434,7 +434,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 92 + "lineNumber": 93 } }, { @@ -447,7 +447,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 93 + "lineNumber": 94 } }, { @@ -467,7 +467,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 94 + "lineNumber": 95 } } ], @@ -477,7 +477,7 @@ ], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 91 + "lineNumber": 92 } }, { @@ -514,7 +514,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 113 + "lineNumber": 114 }, "signature": [ "Record" @@ -528,7 +528,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 114 + "lineNumber": 115 } }, { @@ -539,7 +539,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 115 + "lineNumber": 116 }, "signature": [ { @@ -555,7 +555,7 @@ ], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 112 + "lineNumber": 113 } } ], @@ -565,7 +565,7 @@ ], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 108 + "lineNumber": 109 } }, { @@ -595,7 +595,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 152 + "lineNumber": 153 } }, { @@ -615,7 +615,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 152 + "lineNumber": 153 } } ], @@ -623,20 +623,22 @@ "returnComment": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 152 + "lineNumber": 153 } } ], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 32 + "lineNumber": 33 }, "initialIsOpen": false }, { "id": "def-public.SavedObjectSaveModal", "type": "Class", - "tags": [], + "tags": [ + "deprecated" + ], "label": "SavedObjectSaveModal", "description": [], "signature": [ @@ -671,7 +673,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 72 + "lineNumber": 73 } }, { @@ -682,7 +684,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 73 + "lineNumber": 74 } }, { @@ -693,7 +695,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 74 + "lineNumber": 75 } }, { @@ -704,7 +706,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 75 + "lineNumber": 76 } }, { @@ -715,7 +717,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 76 + "lineNumber": 77 } }, { @@ -726,7 +728,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 77 + "lineNumber": 78 } } ], @@ -734,7 +736,7 @@ "label": "state", "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 71 + "lineNumber": 72 } }, { @@ -750,13 +752,13 @@ "returnComment": [], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 80 + "lineNumber": 81 } } ], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 69 + "lineNumber": 70 }, "initialIsOpen": false } @@ -1517,7 +1519,9 @@ "type": "Interface", "label": "SavedObject", "description": [], - "tags": [], + "tags": [ + "deprecated" + ], "children": [ { "tags": [], @@ -1527,7 +1531,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 25 + "lineNumber": 26 }, "signature": [ "() => { attributes: ", @@ -1557,7 +1561,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 26 + "lineNumber": 27 }, "signature": [ "Record" @@ -1571,7 +1575,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 27 + "lineNumber": 28 }, "signature": [ "(resp: Record) => Promise<", @@ -1593,7 +1597,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 28 + "lineNumber": 29 } }, { @@ -1604,7 +1608,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 29 + "lineNumber": 30 }, "signature": [ "(opts: ", @@ -1626,7 +1630,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 30 + "lineNumber": 31 }, "signature": [ "any" @@ -1640,7 +1644,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 31 + "lineNumber": 32 }, "signature": [ "(() => Promise<{}>) | undefined" @@ -1654,7 +1658,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 32 + "lineNumber": 33 }, "signature": [ "() => void" @@ -1668,7 +1672,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 33 + "lineNumber": 34 }, "signature": [ "() => string" @@ -1682,7 +1686,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 34 + "lineNumber": 35 }, "signature": [ "() => string" @@ -1696,7 +1700,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 35 + "lineNumber": 36 }, "signature": [ "() => string" @@ -1710,7 +1714,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 36 + "lineNumber": 37 }, "signature": [ "((id?: string | undefined) => Promise<", @@ -1732,7 +1736,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 37 + "lineNumber": 38 }, "signature": [ "string | undefined" @@ -1746,7 +1750,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 38 + "lineNumber": 39 }, "signature": [ "(() => Promise<", @@ -1768,7 +1772,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 39 + "lineNumber": 40 } }, { @@ -1779,7 +1783,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 40 + "lineNumber": 41 }, "signature": [ "() => boolean" @@ -1793,7 +1797,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 41 + "lineNumber": 42 } }, { @@ -1804,7 +1808,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 42 + "lineNumber": 43 }, "signature": [ "Record | undefined" @@ -1818,7 +1822,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 43 + "lineNumber": 44 }, "signature": [ "(saveOptions: ", @@ -1840,7 +1844,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 44 + "lineNumber": 45 }, "signature": [ "Pick<", @@ -1862,7 +1866,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 45 + "lineNumber": 46 }, "signature": [ { @@ -1883,7 +1887,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 46 + "lineNumber": 47 } }, { @@ -1894,7 +1898,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 47 + "lineNumber": 48 } }, { @@ -1905,7 +1909,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 48 + "lineNumber": 49 }, "signature": [ { @@ -1921,7 +1925,7 @@ ], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 24 + "lineNumber": 25 }, "initialIsOpen": false }, @@ -1940,7 +1944,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 78 + "lineNumber": 79 }, "signature": [ "((savedObject: ", @@ -1970,7 +1974,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 79 + "lineNumber": 80 }, "signature": [ "any" @@ -1984,7 +1988,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 80 + "lineNumber": 81 }, "signature": [ "((opts: ", @@ -2014,7 +2018,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 81 + "lineNumber": 82 }, "signature": [ "( void) | undefined" @@ -2072,7 +2076,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 84 + "lineNumber": 85 }, "signature": [ { @@ -2093,7 +2097,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 85 + "lineNumber": 86 }, "signature": [ "Record | undefined" @@ -2107,7 +2111,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 86 + "lineNumber": 87 }, "signature": [ "Record | undefined" @@ -2121,7 +2125,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 87 + "lineNumber": 88 }, "signature": [ "string | undefined" @@ -2135,7 +2139,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 88 + "lineNumber": 89 }, "signature": [ "boolean | Pick<", @@ -2157,7 +2161,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 89 + "lineNumber": 90 }, "signature": [ "string | undefined" @@ -2166,7 +2170,7 @@ ], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 76 + "lineNumber": 77 }, "initialIsOpen": false }, @@ -2599,7 +2603,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 52 + "lineNumber": 53 }, "signature": [ "boolean | undefined" @@ -2613,7 +2617,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 53 + "lineNumber": 54 }, "signature": [ "boolean | undefined" @@ -2627,7 +2631,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 54 + "lineNumber": 55 }, "signature": [ "(() => void) | undefined" @@ -2641,7 +2645,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 55 + "lineNumber": 56 }, "signature": [ "boolean | undefined" @@ -2650,7 +2654,7 @@ ], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 51 + "lineNumber": 52 }, "initialIsOpen": false }, @@ -2819,14 +2823,16 @@ "tags": [], "children": [ { - "tags": [], + "tags": [ + "deprecated" + ], "id": "def-public.SavedObjectsStart.SavedObjectClass", "type": "Object", "label": "SavedObjectClass", "description": [], "source": { "path": "src/plugins/saved_objects/public/plugin.ts", - "lineNumber": 26 + "lineNumber": 27 }, "signature": [ "new (raw: Record) => ", @@ -2840,14 +2846,16 @@ ] }, { - "tags": [], + "tags": [ + "deprecated" + ], "id": "def-public.SavedObjectsStart.settings", "type": "Object", "label": "settings", "description": [], "source": { "path": "src/plugins/saved_objects/public/plugin.ts", - "lineNumber": 27 + "lineNumber": 29 }, "signature": [ "{ getPerPage: () => number; getListingLimit: () => number; }" diff --git a/api_docs/security.json b/api_docs/security.json index 5c605debf1908..8e1214654a82f 100644 --- a/api_docs/security.json +++ b/api_docs/security.json @@ -445,6 +445,20 @@ "signature": [ "number | undefined" ] + }, + { + "tags": [], + "id": "def-public.UserMenuLink.setAsProfile", + "type": "CompoundType", + "label": "setAsProfile", + "description": [], + "source": { + "path": "x-pack/plugins/security/public/nav_control/nav_control_component.tsx", + "lineNumber": 33 + }, + "signature": [ + "boolean | undefined" + ] } ], "source": { diff --git a/api_docs/visualizations.json b/api_docs/visualizations.json index 2357e8b12608b..d66aa8b8cbe67 100644 --- a/api_docs/visualizations.json +++ b/api_docs/visualizations.json @@ -476,7 +476,8 @@ "docId": "kibVisualizationsPluginApi", "section": "def-public.SerializedVis", "text": "SerializedVis" - } + }, + "" ], "description": [], "source": { @@ -505,7 +506,15 @@ "section": "def-public.SerializedVis", "text": "SerializedVis" }, - ", \"type\" | \"id\" | \"description\" | \"title\" | \"params\" | \"uiState\"> & Pick<{ data: Partial<", + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + ">, \"type\" | \"id\" | \"description\" | \"title\" | \"params\" | \"uiState\"> & Pick<{ data: Partial<", { "pluginId": "visualizations", "scope": "public", @@ -538,7 +547,15 @@ "section": "def-public.SerializedVis", "text": "SerializedVis" }, - ", \"type\" | \"id\" | \"description\" | \"title\" | \"params\" | \"uiState\"> & Pick<{ data: Partial<", + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + ">, \"type\" | \"id\" | \"description\" | \"title\" | \"params\" | \"uiState\"> & Pick<{ data: Partial<", { "pluginId": "visualizations", "scope": "public", @@ -583,15 +600,7 @@ "section": "def-public.Vis", "text": "Vis" }, - "<", - { - "pluginId": "visualizations", - "scope": "common", - "docId": "kibVisualizationsPluginApi", - "section": "def-common.VisParams", - "text": "VisParams" - }, - ">" + "" ], "description": [], "children": [], @@ -614,7 +623,16 @@ "docId": "kibVisualizationsPluginApi", "section": "def-public.SerializedVis", "text": "SerializedVis" - } + }, + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + ">" ], "description": [], "children": [], @@ -1393,6 +1411,16 @@ "id": "def-public.SerializedVis", "type": "Interface", "label": "SerializedVis", + "signature": [ + { + "pluginId": "visualizations", + "scope": "public", + "docId": "kibVisualizationsPluginApi", + "section": "def-public.SerializedVis", + "text": "SerializedVis" + }, + "" + ], "description": [], "tags": [], "children": [ @@ -1449,7 +1477,7 @@ { "tags": [], "id": "def-public.SerializedVis.params", - "type": "Object", + "type": "Uncategorized", "label": "params", "description": [], "source": { @@ -1457,13 +1485,7 @@ "lineNumber": 47 }, "signature": [ - { - "pluginId": "visualizations", - "scope": "common", - "docId": "kibVisualizationsPluginApi", - "section": "def-common.VisParams", - "text": "VisParams" - } + "T" ] }, { @@ -2922,7 +2944,15 @@ "section": "def-public.SerializedVis", "text": "SerializedVis" }, - " | undefined" + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + "> | undefined" ] }, { @@ -3213,7 +3243,15 @@ "section": "def-public.SerializedVis", "text": "SerializedVis" }, - " | undefined; }, parent?: ", + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + "> | undefined; }, parent?: ", { "pluginId": "embeddable", "scope": "public", @@ -3228,14 +3266,6 @@ "docId": "kibEmbeddablePluginApi", "section": "def-public.ContainerInput", "text": "ContainerInput" - }, - "<{}>, ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.ContainerOutput", - "text": "ContainerOutput" } ], "initialIsOpen": false @@ -3433,7 +3463,15 @@ "section": "def-public.SerializedVis", "text": "SerializedVis" }, - ") => Promise<", + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + ">) => Promise<", { "pluginId": "visualizations", "scope": "public", @@ -3478,7 +3516,16 @@ "docId": "kibVisualizationsPluginApi", "section": "def-public.SerializedVis", "text": "SerializedVis" - } + }, + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + ">" ] }, { @@ -3500,7 +3547,15 @@ "section": "def-public.SerializedVis", "text": "SerializedVis" }, - ") => ", + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + ">) => ", { "pluginId": "visualizations", "scope": "public", diff --git a/docs/user/dashboard/dashboard.asciidoc b/docs/user/dashboard/dashboard.asciidoc index 75589ad74724c..1752f067801b4 100644 --- a/docs/user/dashboard/dashboard.asciidoc +++ b/docs/user/dashboard/dashboard.asciidoc @@ -34,11 +34,14 @@ Dashboards support many types of panels, and provide several editors that you ca | <> | Add context to your panels with <>, or add dynamic filters with <>. -| <> -| Display a previously saved search table from <>. The table results are not aggregated. +| <> +| Display a saved search table from <>. The table results are not aggregated. -| <> -| Display a previously saved visualization of <> anomaly detection data. +| <> +| Display a table of live streaming logs. + +| <> +| Display the results from machine learning anomaly detection jobs. |=== @@ -78,37 +81,84 @@ Begin with an empty dashboard, or open an existing dashboard. * To open an existing dashboard, click the dashboard *Title* you want to open. +[float] +[[add-panels]] +=== Add panels + +To add panels to the dashboard, you can use one of the editors to create a new panel, +add an existing panel from the *Visualize Library*, add a table of live streaming logs, or the add the results from a machine learning anomaly detection job. + [float] [[create-panels-with-lens]] -=== Create panels +==== Create panels + +To create panels, use one of the editors, then add the panel to the dashboard. + +. On the dashboard, click *Create panel*. + +. On the *New visualization* window, click the editor you want to use. *Lens* is recommended for most users. + +. To create the panel, configure the editor options. + +. To add the panel to the dashboard, choose one of the following options: + +* To add the panel to the dashboard without saving to the *Visualize Library*, click *Save and return*. ++ +To add a title to the panel, click *No Title*, enter the *Panel title*, then click *Save*. + +* To save the panel to the *Visualize Library*, click *Save to Library*, configure the options, then click *Save and return*. ++ +When panels are saved in the *Visualize Library*, image:dashboard/images/visualize-library-icon.png[Visualize Library icon] appears in the header. + +[float] +[[add-panels-from-the-library]] +==== Add panels from the library + +Add panels that you've already created from the *Visualize Library*. + +. On the dashboard, click *Add from library*. + +. On the *Add from library* flyout, click the panels you want to add to the dashboard. + +. To close the flyout, click *X*. ++ +When a panel contains a stored query, both queries are applied. -Choose the type of panel you want to create, then save the panel to the dashboard. +. To make changes to the panel, open the panel menu, then select the following options: -. From the dashboard, choose one of the following options: +* *Edit visualization* — Opens an editor so that you can reconfigure the panel. ++ +To make changes to the panel without affecting the original version, open the panel menu, then click *More > Unlink from library*. -* To create a panel, click *Create panel*, then click the panel type on the *New visualization* window. *Lens* is recommended for most users. +* *Edit panel title* — Opens the *Customize panel* window to change the *Panel title* and specify whether you want to display the panel title. -* To add a saved panel, click *Add from library*, then select the panel you want to add. When a panel contains a stored query, both queries are applied. +[float] +[[add-a-table-of-live-streaming-logs]] +==== Add a logs panel -. To save the panel, click *Save* in the toolbar, then configure the *Save visualization* options. +Add a panel that displays a table of live streaming logs. -.. Enter the *Title* and optional *Description*. +. On the dashboard, click *Add from library*. -.. From the *Tags* drop down, select any applicable tags. +. On the *Add from library* flyout, click *Create new*, then select *Log stream*. + +[float] +[[add-machine-learning-results]] +==== Add machine learning results -.. Select *Add to Dashboard after saving*. +Add a panel that displays the results from machine learning anomaly detection jobs. -.. Click *Save and return*. +. On the dashboard, click *Add from library*. -TIP: To access your saved panels, open the main menu, then click *Visualize Library*. +. On the *Add from library* flyout, click *Create new*, then select *ML Anomaly Swim Lane*. [float] [[arrange-panels]] [[moving-containers]] [[resizing-containers]] -=== Arrange panels +=== Arrange the panels -To compare the data in the panels, arrange the panels on the dashboard, or remove the panel from the dashboard. +To compare the data in the panels, reorganize or remove the panels on the dashboard. . From the toolbar, click *Edit*, then use the following options: @@ -116,56 +166,101 @@ To compare the data in the panels, arrange the panels on the dashboard, or remov * To resize, click the resize control, then drag to the new dimensions. -* To delete, open the panel menu, then select *Delete from dashboard*. +* To maximize the panel to fullscreen, open the panel menu, then click *More > Maximize panel*. + +* To delete, open the panel menu, then click *More > Delete from dashboard*. . To save your changes, click *Save* in the toolbar. +[float] +[[apply-design-options]] +=== Apply design options + +Apply a set of design options to the entire dashboard. + +. From the toolbar, click *Edit > Options*. + +. Select the following options: + +* *Use margins between panels* — Specifies a margin of space between each panel. + +* *Show panel titles* — Specifies the appearance of titles in the header of each panel. + +* *Sync color pallettes across panels* — Specifies whether the color pallette is applied to all panels. + [float] [[search-or-filter-your-data]] === Search or filter your data -{kib} provides you with several ways to search your data and apply {es} filters. You can combine the filters with any panel-specific -filters to display the data want to you see. +{kib} provides you with several ways to search your data and apply {es} filters. You can combine the filters with any panel +filter to display the data want to you see. -[role="screenshot"] -image::dashboard/images/dashboard-filters.png[Labeled interface with semi-structured search, time filter, and additional filters] +[float] +[[semi-structured-search]] +==== Semi-structured search + +Combine free text search with field-based search using the <>. +Type a search term to match across all fields, or begin typing a field name to +get prompted with field names and operators you can use to build a structured query. + +For example, in the sample web logs data, the following query displays data only for the US: + +. Enter `g`, then select *geo.source*. -Semi-structured search:: - Combine free text search with field-based search using the <>. - Type a search term to match across all fields, or begin typing a field name to - get prompted with field names and operators you can use to build a structured query. - For example, in the sample web logs data, this query displays data only for the US: +. Select *equals some value* and *US*, then click *Update*. - . Enter `g`, then select *geo.source*. - . Select *equals some value* and *US*, then click *Update*. - . For a more complex search, try: +. For a more complex search, try: [source,text] ------------------- geo.src : "US" and url.keyword : "https://www.elastic.co/downloads/beats/metricbeat" ------------------- -Time filter:: - Dashboards have a global time filter that restricts the data that displays, but individual panels can - override the global time filter. +[float] +[[time-filter]] +==== Time filter + +The <> restrict the data that appears on the dashboard, but you can override the time filter with panel filters. - . To update the time filter, add a panel that displays time on the x-axis. +. To update the time filter, add a panel that displays time-based data along the x-axis. - . Open the panel menu, then select *More > Customize time range*. +. Open the panel menu, then select *More > Customize time range*. - . On the *Customize panel time range* window, specify the new time range, then click *Add to panel*. - +. On the *Customize panel time range* window, specify the time range, then click *Add to panel*. ++ [role="screenshot"] image:images/time_range_per_panel.gif[Time range per dashboard panel] -Additional filters with AND:: - Add filters to a dashboard, or pin filters to multiple places in {kib}. To add filters, using a basic editor or an advanced JSON editor for the {es} {ref}/query-dsl.html[query DSL]. - When you use more than one index pattern on a dashboard, the filter editor allows you to filter only one dashboard. - To dynamically add filters, click a series on a dashboard. For example, to filter the dashboard to display only ios data: - . Click *Add filter*. - . Set *Field* to *machine.os*, *Operator* to *is*, and *Value* to *ios*. - . *Save* the filter. - . To remove the filter, click *x*. +[float] +[[additional-filters-with-and]] +==== Additional filters with AND + +Add filters to a dashboard, or pin filters to multiple places in {kib}. To add filters, you can use the *Edit Filter* options, or the advanced JSON editor for the {es} {ref}/query-dsl.html[Query DSL]. +When there is one or more index patterns on the dashboard, you can select the index pattern that contains the fields you want to create the filter. + +For example, to filter the dashboard to display only ios data from *kibana_sample_data_logs*: + +. Click *Add filter*. + +. From the *Index Pattern* dropdown, select *kibana_sample_data_logs*. + +. Set *Field* to *machine.os*, *Operator* to *is*, and *Value* to *ios*. + +. *Save* the filter. ++ +To remove the filter, click *x*. + +[float] +[[add-dynamic-filters]] +==== Add dynamic filters + +When you see data in a panel that you want to use as a filter, you can dynamically create the filter. To dynamically add filters, click the data in a panel. + +. Click the data in the panel. + +. Select filters you want to apply to all of the dashboard panels, then click *Apply*. ++ +To remove the filters, click *x*. [float] [[clone-panels]] @@ -173,7 +268,7 @@ Additional filters with AND:: To duplicate a panel and the configured functionality, clone the panel. Cloned panels continue to replicate all of the functionality from the original panel, including renaming, editing, and cloning. When you clone a panel, the clone appears beside the original panel, and moves other panels to provide a space on the -dashboard. +dashboard. . From the toolbar, click *Edit*. @@ -182,52 +277,75 @@ dashboard. [role="screenshot"] image:images/clone_panel.gif[clone panel] + -To access the cloned panel, open the main menu, then click *Visualize Library*. +When cloned panels are saved in the *Visualize Library*, image:dashboard/images/visualize-library-icon.png[Visualize Library icon] appears in the header. + +[float] +[[copy-to-dashboard]] +=== Copy panels + +To add a panel to another dashboard, copy the panel. + +. Open the panel menu, then select *More > Copy to dashboard*. + +. On the *Copy to dashboard* window, select the dashboard, then click *Copy and go to dashboard*. [float] [[explore-the-underlying-data]] === Explore the underlying documents -Dashboard panels have a shortcut to view the underlying documents in *Discover*. Open the panel menu, -then click *Explore underlying data*. *Discover* will be opened with the same time range and filters as the panel. +View the underlying documents in a panel, or in a data series. + +TIP: *Explore underlying data* is supported only for visualization panels with a single index pattern. +To view the underlying documents in the panel: + +. Open the panel menu. + +. Click *Explore underlying data*. ++ +*Discover* opens with the same time range and filters as the panel. ++ [role="screenshot"] image::images/explore_data_context_menu.png[Explore underlying data from panel context menu] -A second shortcut is disabled by default, and creates a new interaction when clicking on a chart. -This shortcut is similar to a <>, but can show you data for only one series. -To enable the chart interactivity shortcut, add the following to kibana.yml: +To view the underlying documents in a data series: +. In kibana.yml, add the following: ++ ["source","yml"] ----------- xpack.discoverEnhanced.actions.exploreDataInChart.enabled: true ----------- +. Open the dashboard, then click on the data series you want to view. ++ [role="screenshot"] image::images/explore_data_in_chart.png[Explore underlying data from chart] -TIP: *Explore underlying data* is available only for visualization panels with a single index pattern. - [float] [[download-csv]] -=== Download panel data as CSV +=== Download the panel data Download panel data in a CSV file. You can download most panels in a CSV file, but there is a shortcut available for *Lens* panels. [role="xpack"] -Lens:: +To download *Lens* panel data in a CSV file: + Open the *Lens* panel menu, then select *More > Download as CSV*. -+ + [role="screenshot"] image::images/download_csv_context_menu.png[Download as CSV from panel context menu] -All panels:: - . Open the panel menu, then select *Inspect*. +To download all other panel data in a CSV file: + +. Open the panel menu, then select *Inspect*. - . Click *Download CSV*, then select the CSV type from the dropdown. The *Formatted CSV* contains - human-readable dates and numbers, while the *Unformatted* option is for computer use. +. Click *Download CSV*, then select the CSV type from the dropdown: +* *Formatted CSV* — Contains human-readable dates and numbers. +* *Unformatted* — Best used for computer use. ++ [role="screenshot"] image:images/Dashboard_inspect.png[Inspect in dashboard] @@ -237,15 +355,13 @@ image:images/Dashboard_inspect.png[Inspect in dashboard] When you're finished making changes, save the dashboard. -. From the toolbar, click *Save*. - -. Enter the dashboard *Title* and an optional *Description*. +From the toolbar, choose one of the following options: -. From the *Tags* dropdown, select the tags you want to apply. +* *Save as* — Opens the *Save dashboard* window, which allows you to specify the title and dashboard options. -. To save the time range, select *Store time with dashboard*. +* *Save* — Allows you to save the changes you've made to an existing dashboard. -. Click *Save*. +* *Switch to view mode* — Allows you to exit *Edit* mode without saving your changes, or you can discard the changes you've made. All dashboards with unsaved changes display *Unsaved changes* in the toolbar. [float] [[share-the-dashboard]] diff --git a/docs/user/dashboard/images/clone_panel.gif b/docs/user/dashboard/images/clone_panel.gif index e521e438d051a..7fba789a2bf54 100644 Binary files a/docs/user/dashboard/images/clone_panel.gif and b/docs/user/dashboard/images/clone_panel.gif differ diff --git a/docs/user/dashboard/images/visualize-library-icon.png b/docs/user/dashboard/images/visualize-library-icon.png new file mode 100644 index 0000000000000..19031df9f4af8 Binary files /dev/null and b/docs/user/dashboard/images/visualize-library-icon.png differ diff --git a/src/core/server/ui_settings/saved_objects/migrations.test.ts b/src/core/server/ui_settings/saved_objects/migrations.test.ts index 7b53f4e21dd9b..cf96372bd20bc 100644 --- a/src/core/server/ui_settings/saved_objects/migrations.test.ts +++ b/src/core/server/ui_settings/saved_objects/migrations.test.ts @@ -45,6 +45,39 @@ describe('ui_settings 7.9.0 migrations', () => { }); }); +describe('ui_settings 7.12.0 migrations', () => { + const migration = migrations['7.12.0']; + + test('returns doc on empty object', () => { + expect(migration({} as SavedObjectUnsanitizedDoc)).toEqual({ + references: [], + }); + }); + test('properly migrates timepicker:quickRanges', () => { + const initialQuickRange: any = { + from: '123', + to: '321', + display: 'abc', + section: 2, + }; + const { section, ...migratedQuickRange } = initialQuickRange; + + const doc = { + type: 'config', + id: '8.0.0', + attributes: { + buildNum: 9007199254740991, + 'timepicker:quickRanges': JSON.stringify([initialQuickRange]), + }, + references: [], + updated_at: '2020-06-09T20:18:20.349Z', + migrationVersion: {}, + }; + const migrated = migration(doc); + expect(JSON.parse(migrated.attributes['timepicker:quickRanges'])).toEqual([migratedQuickRange]); + }); +}); + describe('ui_settings 7.13.0 migrations', () => { const migration = migrations['7.13.0']; diff --git a/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js b/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js index 72083bd335c68..4d1cede837f13 100644 --- a/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js +++ b/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js @@ -46,29 +46,28 @@ module.exports = (function() { if (query !== null) return query; return nodeTypes.function.buildNode('is', '*', '*'); }, - peg$c1 = function() { return errorOnLuceneSyntax; }, - peg$c2 = function(head, query) { return query; }, - peg$c3 = function(head, tail) { + peg$c1 = function(head, query) { return query; }, + peg$c2 = function(head, tail) { const nodes = [head, ...tail]; const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); if (cursor) return cursor; return buildFunctionNode('or', nodes); }, - peg$c4 = function(head, tail) { + peg$c3 = function(head, tail) { const nodes = [head, ...tail]; const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); if (cursor) return cursor; return buildFunctionNode('and', nodes); }, - peg$c5 = function(query) { + peg$c4 = function(query) { if (query.type === 'cursor') return query; return buildFunctionNode('not', [query]); }, - peg$c6 = "(", - peg$c7 = { type: "literal", value: "(", description: "\"(\"" }, - peg$c8 = ")", - peg$c9 = { type: "literal", value: ")", description: "\")\"" }, - peg$c10 = function(query, trailing) { + peg$c5 = "(", + peg$c6 = { type: "literal", value: "(", description: "\"(\"" }, + peg$c7 = ")", + peg$c8 = { type: "literal", value: ")", description: "\")\"" }, + peg$c9 = function(query, trailing) { if (trailing.type === 'cursor') { return { ...trailing, @@ -77,13 +76,13 @@ module.exports = (function() { } return query; }, - peg$c11 = ":", - peg$c12 = { type: "literal", value: ":", description: "\":\"" }, - peg$c13 = "{", - peg$c14 = { type: "literal", value: "{", description: "\"{\"" }, - peg$c15 = "}", - peg$c16 = { type: "literal", value: "}", description: "\"}\"" }, - peg$c17 = function(field, query, trailing) { + peg$c10 = ":", + peg$c11 = { type: "literal", value: ":", description: "\":\"" }, + peg$c12 = "{", + peg$c13 = { type: "literal", value: "{", description: "\"{\"" }, + peg$c14 = "}", + peg$c15 = { type: "literal", value: "}", description: "\"}\"" }, + peg$c16 = function(field, query, trailing) { if (query.type === 'cursor') { return { ...query, @@ -99,8 +98,8 @@ module.exports = (function() { } return buildFunctionNode('nested', [field, query]); }, - peg$c18 = { type: "other", description: "fieldName" }, - peg$c19 = function(field, operator, value) { + peg$c17 = { type: "other", description: "fieldName" }, + peg$c18 = function(field, operator, value) { if (value.type === 'cursor') { return { ...value, @@ -110,7 +109,7 @@ module.exports = (function() { const range = buildNamedArgNode(operator, value); return buildFunctionNode('range', [field, range]); }, - peg$c20 = function(field, partial) { + peg$c19 = function(field, partial) { if (partial.type === 'cursor') { return { ...partial, @@ -120,7 +119,7 @@ module.exports = (function() { } return partial(field); }, - peg$c21 = function(partial) { + peg$c20 = function(partial) { if (partial.type === 'cursor') { const fieldName = `${partial.prefix}${partial.suffix}`.trim(); return { @@ -132,7 +131,7 @@ module.exports = (function() { const field = buildLiteralNode(null); return partial(field); }, - peg$c22 = function(partial, trailing) { + peg$c21 = function(partial, trailing) { if (trailing.type === 'cursor') { return { ...trailing, @@ -141,8 +140,8 @@ module.exports = (function() { } return partial; }, - peg$c23 = function(head, partial) { return partial; }, - peg$c24 = function(head, tail) { + peg$c22 = function(head, partial) { return partial; }, + peg$c23 = function(head, tail) { const nodes = [head, ...tail]; const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); if (cursor) { @@ -153,7 +152,7 @@ module.exports = (function() { } return (field) => buildFunctionNode('or', nodes.map(partial => partial(field))); }, - peg$c25 = function(head, tail) { + peg$c24 = function(head, tail) { const nodes = [head, ...tail]; const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); if (cursor) { @@ -164,7 +163,7 @@ module.exports = (function() { } return (field) => buildFunctionNode('and', nodes.map(partial => partial(field))); }, - peg$c26 = function(partial) { + peg$c25 = function(partial) { if (partial.type === 'cursor') { return { ...list, @@ -173,13 +172,13 @@ module.exports = (function() { } return (field) => buildFunctionNode('not', [partial(field)]); }, - peg$c27 = { type: "other", description: "value" }, - peg$c28 = function(value) { + peg$c26 = { type: "other", description: "value" }, + peg$c27 = function(value) { if (value.type === 'cursor') return value; const isPhrase = buildLiteralNode(true); return (field) => buildFunctionNode('is', [field, value, isPhrase]); }, - peg$c29 = function(value) { + peg$c28 = function(value) { if (value.type === 'cursor') return value; if (!allowLeadingWildcards && value.type === 'wildcard' && nodeTypes.wildcard.hasLeadingWildcard(value)) { @@ -189,20 +188,20 @@ module.exports = (function() { const isPhrase = buildLiteralNode(false); return (field) => buildFunctionNode('is', [field, value, isPhrase]); }, - peg$c30 = { type: "other", description: "OR" }, - peg$c31 = "or", - peg$c32 = { type: "literal", value: "or", description: "\"or\"" }, - peg$c33 = { type: "other", description: "AND" }, - peg$c34 = "and", - peg$c35 = { type: "literal", value: "and", description: "\"and\"" }, - peg$c36 = { type: "other", description: "NOT" }, - peg$c37 = "not", - peg$c38 = { type: "literal", value: "not", description: "\"not\"" }, - peg$c39 = { type: "other", description: "literal" }, - peg$c40 = function() { return parseCursor; }, - peg$c41 = "\"", - peg$c42 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c43 = function(prefix, cursor, suffix) { + peg$c29 = { type: "other", description: "OR" }, + peg$c30 = "or", + peg$c31 = { type: "literal", value: "or", description: "\"or\"" }, + peg$c32 = { type: "other", description: "AND" }, + peg$c33 = "and", + peg$c34 = { type: "literal", value: "and", description: "\"and\"" }, + peg$c35 = { type: "other", description: "NOT" }, + peg$c36 = "not", + peg$c37 = { type: "literal", value: "not", description: "\"not\"" }, + peg$c38 = { type: "other", description: "literal" }, + peg$c39 = function() { return parseCursor; }, + peg$c40 = "\"", + peg$c41 = { type: "literal", value: "\"", description: "\"\\\"\"" }, + peg$c42 = function(prefix, cursor, suffix) { const { start, end } = location(); return { type: 'cursor', @@ -213,17 +212,17 @@ module.exports = (function() { text: text().replace(cursor, '') }; }, - peg$c44 = function(chars) { + peg$c43 = function(chars) { return buildLiteralNode(chars.join('')); }, - peg$c45 = "\\", - peg$c46 = { type: "literal", value: "\\", description: "\"\\\\\"" }, - peg$c47 = /^[\\"]/, - peg$c48 = { type: "class", value: "[\\\\\"]", description: "[\\\\\"]" }, - peg$c49 = function(char) { return char; }, - peg$c50 = /^[^"]/, - peg$c51 = { type: "class", value: "[^\"]", description: "[^\"]" }, - peg$c52 = function(chars) { + peg$c44 = "\\", + peg$c45 = { type: "literal", value: "\\", description: "\"\\\\\"" }, + peg$c46 = /^[\\"]/, + peg$c47 = { type: "class", value: "[\\\\\"]", description: "[\\\\\"]" }, + peg$c48 = function(char) { return char; }, + peg$c49 = /^[^"]/, + peg$c50 = { type: "class", value: "[^\"]", description: "[^\"]" }, + peg$c51 = function(chars) { const sequence = chars.join('').trim(); if (sequence === 'null') return buildLiteralNode(null); if (sequence === 'true') return buildLiteralNode(true); @@ -231,103 +230,40 @@ module.exports = (function() { if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); return buildLiteralNode(sequence); }, - peg$c53 = { type: "any", description: "any character" }, - peg$c54 = "*", - peg$c55 = { type: "literal", value: "*", description: "\"*\"" }, - peg$c56 = function() { return wildcardSymbol; }, - peg$c57 = "\\t", - peg$c58 = { type: "literal", value: "\\t", description: "\"\\\\t\"" }, - peg$c59 = function() { return '\t'; }, - peg$c60 = "\\r", - peg$c61 = { type: "literal", value: "\\r", description: "\"\\\\r\"" }, - peg$c62 = function() { return '\r'; }, - peg$c63 = "\\n", - peg$c64 = { type: "literal", value: "\\n", description: "\"\\\\n\"" }, - peg$c65 = function() { return '\n'; }, - peg$c66 = function(keyword) { return keyword; }, - peg$c67 = /^[\\():<>"*{}]/, - peg$c68 = { type: "class", value: "[\\\\():<>\"*{}]", description: "[\\\\():<>\"*{}]" }, - peg$c69 = "<=", - peg$c70 = { type: "literal", value: "<=", description: "\"<=\"" }, - peg$c71 = function() { return 'lte'; }, - peg$c72 = ">=", - peg$c73 = { type: "literal", value: ">=", description: "\">=\"" }, - peg$c74 = function() { return 'gte'; }, - peg$c75 = "<", - peg$c76 = { type: "literal", value: "<", description: "\"<\"" }, - peg$c77 = function() { return 'lt'; }, - peg$c78 = ">", - peg$c79 = { type: "literal", value: ">", description: "\">\"" }, - peg$c80 = function() { return 'gt'; }, - peg$c81 = { type: "other", description: "whitespace" }, - peg$c82 = /^[ \t\r\n]/, - peg$c83 = { type: "class", value: "[\\ \\t\\r\\n]", description: "[\\ \\t\\r\\n]" }, - peg$c84 = "@kuery-cursor@", - peg$c85 = { type: "literal", value: "@kuery-cursor@", description: "\"@kuery-cursor@\"" }, - peg$c86 = function() { return cursorSymbol; }, - peg$c87 = "||", - peg$c88 = { type: "literal", value: "||", description: "\"||\"" }, - peg$c89 = function() { - error('LuceneOr'); - }, - peg$c90 = "&&", - peg$c91 = { type: "literal", value: "&&", description: "\"&&\"" }, - peg$c92 = function() { - error('LuceneAnd'); - }, - peg$c93 = "+", - peg$c94 = { type: "literal", value: "+", description: "\"+\"" }, - peg$c95 = "-", - peg$c96 = { type: "literal", value: "-", description: "\"-\"" }, - peg$c97 = function() { - error('LuceneNot'); - }, - peg$c98 = "!", - peg$c99 = { type: "literal", value: "!", description: "\"!\"" }, - peg$c100 = "_exists_", - peg$c101 = { type: "literal", value: "_exists_", description: "\"_exists_\"" }, - peg$c102 = function() { - error('LuceneExists'); - }, - peg$c103 = function() { - error('LuceneRange'); - }, - peg$c104 = "?", - peg$c105 = { type: "literal", value: "?", description: "\"?\"" }, - peg$c106 = function() { - error('LuceneWildcard'); - }, - peg$c107 = "/", - peg$c108 = { type: "literal", value: "/", description: "\"/\"" }, - peg$c109 = /^[^\/]/, - peg$c110 = { type: "class", value: "[^/]", description: "[^/]" }, - peg$c111 = function() { - error('LuceneRegex'); - }, - peg$c112 = "~", - peg$c113 = { type: "literal", value: "~", description: "\"~\"" }, - peg$c114 = /^[0-9]/, - peg$c115 = { type: "class", value: "[0-9]", description: "[0-9]" }, - peg$c116 = function() { - error('LuceneFuzzy'); - }, - peg$c117 = function() { - error('LuceneProximity'); - }, - peg$c118 = "^", - peg$c119 = { type: "literal", value: "^", description: "\"^\"" }, - peg$c120 = function() { - error('LuceneBoost'); - }, - peg$c121 = function() { return char; }, - peg$c122 = "=", - peg$c123 = { type: "literal", value: "=", description: "\"=\"" }, - peg$c124 = "[", - peg$c125 = { type: "literal", value: "[", description: "\"[\"" }, - peg$c126 = "]", - peg$c127 = { type: "literal", value: "]", description: "\"]\"" }, - peg$c128 = "TO", - peg$c129 = { type: "literal", value: "TO", description: "\"TO\"" }, + peg$c52 = { type: "any", description: "any character" }, + peg$c53 = "*", + peg$c54 = { type: "literal", value: "*", description: "\"*\"" }, + peg$c55 = function() { return wildcardSymbol; }, + peg$c56 = "\\t", + peg$c57 = { type: "literal", value: "\\t", description: "\"\\\\t\"" }, + peg$c58 = function() { return '\t'; }, + peg$c59 = "\\r", + peg$c60 = { type: "literal", value: "\\r", description: "\"\\\\r\"" }, + peg$c61 = function() { return '\r'; }, + peg$c62 = "\\n", + peg$c63 = { type: "literal", value: "\\n", description: "\"\\\\n\"" }, + peg$c64 = function() { return '\n'; }, + peg$c65 = function(keyword) { return keyword; }, + peg$c66 = /^[\\():<>"*{}]/, + peg$c67 = { type: "class", value: "[\\\\():<>\"*{}]", description: "[\\\\():<>\"*{}]" }, + peg$c68 = "<=", + peg$c69 = { type: "literal", value: "<=", description: "\"<=\"" }, + peg$c70 = function() { return 'lte'; }, + peg$c71 = ">=", + peg$c72 = { type: "literal", value: ">=", description: "\">=\"" }, + peg$c73 = function() { return 'gte'; }, + peg$c74 = "<", + peg$c75 = { type: "literal", value: "<", description: "\"<\"" }, + peg$c76 = function() { return 'lt'; }, + peg$c77 = ">", + peg$c78 = { type: "literal", value: ">", description: "\">\"" }, + peg$c79 = function() { return 'gt'; }, + peg$c80 = { type: "other", description: "whitespace" }, + peg$c81 = /^[ \t\r\n]/, + peg$c82 = { type: "class", value: "[\\ \\t\\r\\n]", description: "[\\ \\t\\r\\n]" }, + peg$c83 = "@kuery-cursor@", + peg$c84 = { type: "literal", value: "@kuery-cursor@", description: "\"@kuery-cursor@\"" }, + peg$c85 = function() { return cursorSymbol; }, peg$currPos = 0, peg$savedPos = 0, @@ -519,7 +455,7 @@ module.exports = (function() { function peg$parsestart() { var s0, s1, s2, s3; - var key = peg$currPos * 56 + 0, + var key = peg$currPos * 34 + 0, cached = peg$resultsCache[key]; if (cached) { @@ -567,7 +503,7 @@ module.exports = (function() { function peg$parseOrQuery() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 1, + var key = peg$currPos * 34 + 1, cached = peg$resultsCache[key]; if (cached) { @@ -577,85 +513,62 @@ module.exports = (function() { } s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c1(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } + s1 = peg$parseAndQuery(); if (s1 !== peg$FAILED) { - s2 = peg$parseLuceneQuery(); - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parseAndQuery(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c2(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + s2 = []; + s3 = peg$currPos; + s4 = peg$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, s5); + s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c2(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, s5); + s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } + } else { + peg$currPos = s3; + s3 = peg$FAILED; } - } else { - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c3(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c2(s1, s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseAndQuery(); - } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseAndQuery(); } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -666,7 +579,7 @@ module.exports = (function() { function peg$parseAndQuery() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 2, + var key = peg$currPos * 34 + 2, cached = peg$resultsCache[key]; if (cached) { @@ -685,7 +598,7 @@ module.exports = (function() { s5 = peg$parseNotQuery(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c2(s1, s5); + s4 = peg$c1(s1, s5); s3 = s4; } else { peg$currPos = s3; @@ -704,7 +617,7 @@ module.exports = (function() { s5 = peg$parseNotQuery(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c2(s1, s5); + s4 = peg$c1(s1, s5); s3 = s4; } else { peg$currPos = s3; @@ -720,7 +633,7 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c4(s1, s2); + s1 = peg$c3(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -742,7 +655,7 @@ module.exports = (function() { function peg$parseNotQuery() { var s0, s1, s2; - var key = peg$currPos * 56 + 3, + var key = peg$currPos * 34 + 3, cached = peg$resultsCache[key]; if (cached) { @@ -757,7 +670,7 @@ module.exports = (function() { s2 = peg$parseSubQuery(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c5(s2); + s1 = peg$c4(s2); s0 = s1; } else { peg$currPos = s0; @@ -779,7 +692,7 @@ module.exports = (function() { function peg$parseSubQuery() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 4, + var key = peg$currPos * 34 + 4, cached = peg$resultsCache[key]; if (cached) { @@ -790,11 +703,11 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c6; + s1 = peg$c5; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } + if (peg$silentFails === 0) { peg$fail(peg$c6); } } if (s1 !== peg$FAILED) { s2 = []; @@ -809,15 +722,15 @@ module.exports = (function() { s4 = peg$parseOptionalSpace(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c8; + s5 = peg$c7; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c9); } + if (peg$silentFails === 0) { peg$fail(peg$c8); } } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c10(s3, s4); + s1 = peg$c9(s3, s4); s0 = s1; } else { peg$currPos = s0; @@ -851,7 +764,7 @@ module.exports = (function() { function peg$parseNestedQuery() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; - var key = peg$currPos * 56 + 5, + var key = peg$currPos * 34 + 5, cached = peg$resultsCache[key]; if (cached) { @@ -871,11 +784,11 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c11; + s3 = peg$c10; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c12); } + if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s3 !== peg$FAILED) { s4 = []; @@ -886,11 +799,11 @@ module.exports = (function() { } if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 123) { - s5 = peg$c13; + s5 = peg$c12; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } + if (peg$silentFails === 0) { peg$fail(peg$c13); } } if (s5 !== peg$FAILED) { s6 = []; @@ -905,15 +818,15 @@ module.exports = (function() { s8 = peg$parseOptionalSpace(); if (s8 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { - s9 = peg$c15; + s9 = peg$c14; peg$currPos++; } else { s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c16); } + if (peg$silentFails === 0) { peg$fail(peg$c15); } } if (s9 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c17(s1, s7, s8); + s1 = peg$c16(s1, s7, s8); s0 = s1; } else { peg$currPos = s0; @@ -963,7 +876,7 @@ module.exports = (function() { function peg$parseExpression() { var s0; - var key = peg$currPos * 56 + 6, + var key = peg$currPos * 34 + 6, cached = peg$resultsCache[key]; if (cached) { @@ -988,7 +901,7 @@ module.exports = (function() { function peg$parseField() { var s0, s1; - var key = peg$currPos * 56 + 7, + var key = peg$currPos * 34 + 7, cached = peg$resultsCache[key]; if (cached) { @@ -1002,7 +915,7 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c18); } + if (peg$silentFails === 0) { peg$fail(peg$c17); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1013,7 +926,7 @@ module.exports = (function() { function peg$parseFieldRangeExpression() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 8, + var key = peg$currPos * 34 + 8, cached = peg$resultsCache[key]; if (cached) { @@ -1044,7 +957,7 @@ module.exports = (function() { s5 = peg$parseLiteral(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c19(s1, s3, s5); + s1 = peg$c18(s1, s3, s5); s0 = s1; } else { peg$currPos = s0; @@ -1075,7 +988,7 @@ module.exports = (function() { function peg$parseFieldValueExpression() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 9, + var key = peg$currPos * 34 + 9, cached = peg$resultsCache[key]; if (cached) { @@ -1095,11 +1008,11 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c11; + s3 = peg$c10; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c12); } + if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s3 !== peg$FAILED) { s4 = []; @@ -1112,7 +1025,7 @@ module.exports = (function() { s5 = peg$parseListOfValues(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c20(s1, s5); + s1 = peg$c19(s1, s5); s0 = s1; } else { peg$currPos = s0; @@ -1143,7 +1056,7 @@ module.exports = (function() { function peg$parseValueExpression() { var s0, s1; - var key = peg$currPos * 56 + 10, + var key = peg$currPos * 34 + 10, cached = peg$resultsCache[key]; if (cached) { @@ -1156,7 +1069,7 @@ module.exports = (function() { s1 = peg$parseValue(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c21(s1); + s1 = peg$c20(s1); } s0 = s1; @@ -1168,7 +1081,7 @@ module.exports = (function() { function peg$parseListOfValues() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 11, + var key = peg$currPos * 34 + 11, cached = peg$resultsCache[key]; if (cached) { @@ -1179,11 +1092,11 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c6; + s1 = peg$c5; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } + if (peg$silentFails === 0) { peg$fail(peg$c6); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1198,15 +1111,15 @@ module.exports = (function() { s4 = peg$parseOptionalSpace(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c8; + s5 = peg$c7; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c9); } + if (peg$silentFails === 0) { peg$fail(peg$c8); } } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c22(s3, s4); + s1 = peg$c21(s3, s4); s0 = s1; } else { peg$currPos = s0; @@ -1240,7 +1153,7 @@ module.exports = (function() { function peg$parseOrListOfValues() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 12, + var key = peg$currPos * 34 + 12, cached = peg$resultsCache[key]; if (cached) { @@ -1259,7 +1172,7 @@ module.exports = (function() { s5 = peg$parseAndListOfValues(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c23(s1, s5); + s4 = peg$c22(s1, s5); s3 = s4; } else { peg$currPos = s3; @@ -1278,7 +1191,7 @@ module.exports = (function() { s5 = peg$parseAndListOfValues(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c23(s1, s5); + s4 = peg$c22(s1, s5); s3 = s4; } else { peg$currPos = s3; @@ -1294,7 +1207,7 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c24(s1, s2); + s1 = peg$c23(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -1316,7 +1229,7 @@ module.exports = (function() { function peg$parseAndListOfValues() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 13, + var key = peg$currPos * 34 + 13, cached = peg$resultsCache[key]; if (cached) { @@ -1335,7 +1248,7 @@ module.exports = (function() { s5 = peg$parseNotListOfValues(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c23(s1, s5); + s4 = peg$c22(s1, s5); s3 = s4; } else { peg$currPos = s3; @@ -1354,7 +1267,7 @@ module.exports = (function() { s5 = peg$parseNotListOfValues(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c23(s1, s5); + s4 = peg$c22(s1, s5); s3 = s4; } else { peg$currPos = s3; @@ -1370,7 +1283,7 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c25(s1, s2); + s1 = peg$c24(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -1392,7 +1305,7 @@ module.exports = (function() { function peg$parseNotListOfValues() { var s0, s1, s2; - var key = peg$currPos * 56 + 14, + var key = peg$currPos * 34 + 14, cached = peg$resultsCache[key]; if (cached) { @@ -1407,7 +1320,7 @@ module.exports = (function() { s2 = peg$parseListOfValues(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c26(s2); + s1 = peg$c25(s2); s0 = s1; } else { peg$currPos = s0; @@ -1429,7 +1342,7 @@ module.exports = (function() { function peg$parseValue() { var s0, s1; - var key = peg$currPos * 56 + 15, + var key = peg$currPos * 34 + 15, cached = peg$resultsCache[key]; if (cached) { @@ -1443,7 +1356,7 @@ module.exports = (function() { s1 = peg$parseQuotedString(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c28(s1); + s1 = peg$c27(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -1451,14 +1364,14 @@ module.exports = (function() { s1 = peg$parseUnquotedLiteral(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c29(s1); + s1 = peg$c28(s1); } s0 = s1; } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c27); } + if (peg$silentFails === 0) { peg$fail(peg$c26); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1469,7 +1382,7 @@ module.exports = (function() { function peg$parseOr() { var s0, s1, s2, s3, s4; - var key = peg$currPos * 56 + 16, + var key = peg$currPos * 34 + 16, cached = peg$resultsCache[key]; if (cached) { @@ -1491,12 +1404,12 @@ module.exports = (function() { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c31) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { s2 = input.substr(peg$currPos, 2); peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c32); } + if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s2 !== peg$FAILED) { s3 = []; @@ -1524,33 +1437,10 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c1(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = peg$parseLuceneOr(); - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c30); } + if (peg$silentFails === 0) { peg$fail(peg$c29); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1561,7 +1451,7 @@ module.exports = (function() { function peg$parseAnd() { var s0, s1, s2, s3, s4; - var key = peg$currPos * 56 + 17, + var key = peg$currPos * 34 + 17, cached = peg$resultsCache[key]; if (cached) { @@ -1583,12 +1473,12 @@ module.exports = (function() { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c34) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { s2 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c35); } + if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s2 !== peg$FAILED) { s3 = []; @@ -1616,33 +1506,10 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c1(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = peg$parseLuceneAnd(); - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c33); } + if (peg$silentFails === 0) { peg$fail(peg$c32); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1653,7 +1520,7 @@ module.exports = (function() { function peg$parseNot() { var s0, s1, s2, s3; - var key = peg$currPos * 56 + 18, + var key = peg$currPos * 34 + 18, cached = peg$resultsCache[key]; if (cached) { @@ -1664,12 +1531,12 @@ module.exports = (function() { peg$silentFails++; s0 = peg$currPos; - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c37) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { s1 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$c37); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1693,33 +1560,10 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c1(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = peg$parseLuceneNot(); - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } + if (peg$silentFails === 0) { peg$fail(peg$c35); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1730,7 +1574,7 @@ module.exports = (function() { function peg$parseLiteral() { var s0, s1; - var key = peg$currPos * 56 + 19, + var key = peg$currPos * 34 + 19, cached = peg$resultsCache[key]; if (cached) { @@ -1747,7 +1591,7 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c39); } + if (peg$silentFails === 0) { peg$fail(peg$c38); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1758,7 +1602,7 @@ module.exports = (function() { function peg$parseQuotedString() { var s0, s1, s2, s3, s4, s5, s6; - var key = peg$currPos * 56 + 20, + var key = peg$currPos * 34 + 20, cached = peg$resultsCache[key]; if (cached) { @@ -1769,7 +1613,7 @@ module.exports = (function() { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$c40(); + s1 = peg$c39(); if (s1) { s1 = void 0; } else { @@ -1777,11 +1621,11 @@ module.exports = (function() { } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c41; + s2 = peg$c40; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c42); } + if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s2 !== peg$FAILED) { s3 = []; @@ -1801,15 +1645,15 @@ module.exports = (function() { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c41; + s6 = peg$c40; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c42); } + if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c43(s3, s4, s5); + s1 = peg$c42(s3, s4, s5); s0 = s1; } else { peg$currPos = s0; @@ -1838,11 +1682,11 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c41; + s1 = peg$c40; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c42); } + if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1853,15 +1697,15 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c41; + s3 = peg$c40; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c42); } + if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c44(s2); + s1 = peg$c43(s2); s0 = s1; } else { peg$currPos = s0; @@ -1885,7 +1729,7 @@ module.exports = (function() { function peg$parseQuotedCharacter() { var s0, s1, s2; - var key = peg$currPos * 56 + 21, + var key = peg$currPos * 34 + 21, cached = peg$resultsCache[key]; if (cached) { @@ -1898,23 +1742,23 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c45; + s1 = peg$c44; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } + if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { - if (peg$c47.test(input.charAt(peg$currPos))) { + if (peg$c46.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } + if (peg$silentFails === 0) { peg$fail(peg$c47); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c49(s2); + s1 = peg$c48(s2); s0 = s1; } else { peg$currPos = s0; @@ -1937,16 +1781,16 @@ module.exports = (function() { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { - if (peg$c50.test(input.charAt(peg$currPos))) { + if (peg$c49.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c51); } + if (peg$silentFails === 0) { peg$fail(peg$c50); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c49(s2); + s1 = peg$c48(s2); s0 = s1; } else { peg$currPos = s0; @@ -1967,7 +1811,7 @@ module.exports = (function() { function peg$parseUnquotedLiteral() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 22, + var key = peg$currPos * 34 + 22, cached = peg$resultsCache[key]; if (cached) { @@ -1978,7 +1822,7 @@ module.exports = (function() { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$c40(); + s1 = peg$c39(); if (s1) { s1 = void 0; } else { @@ -2002,7 +1846,7 @@ module.exports = (function() { } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c43(s2, s3, s4); + s1 = peg$c42(s2, s3, s4); s0 = s1; } else { peg$currPos = s0; @@ -2034,7 +1878,7 @@ module.exports = (function() { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c52(s1); + s1 = peg$c51(s1); } s0 = s1; } @@ -2047,7 +1891,7 @@ module.exports = (function() { function peg$parseUnquotedCharacter() { var s0, s1, s2, s3, s4; - var key = peg$currPos * 56 + 23, + var key = peg$currPos * 34 + 23, cached = peg$resultsCache[key]; if (cached) { @@ -2103,11 +1947,11 @@ module.exports = (function() { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c53); } + if (peg$silentFails === 0) { peg$fail(peg$c52); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c49(s4); + s1 = peg$c48(s4); s0 = s1; } else { peg$currPos = s0; @@ -2138,7 +1982,7 @@ module.exports = (function() { function peg$parseWildcard() { var s0, s1; - var key = peg$currPos * 56 + 24, + var key = peg$currPos * 34 + 24, cached = peg$resultsCache[key]; if (cached) { @@ -2149,15 +1993,15 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 42) { - s1 = peg$c54; + s1 = peg$c53; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c55); } + if (peg$silentFails === 0) { peg$fail(peg$c54); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c56(); + s1 = peg$c55(); } s0 = s1; @@ -2169,7 +2013,7 @@ module.exports = (function() { function peg$parseOptionalSpace() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 25, + var key = peg$currPos * 34 + 25, cached = peg$resultsCache[key]; if (cached) { @@ -2180,7 +2024,7 @@ module.exports = (function() { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$c40(); + s1 = peg$c39(); if (s1) { s1 = void 0; } else { @@ -2204,7 +2048,7 @@ module.exports = (function() { } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c43(s2, s3, s4); + s1 = peg$c42(s2, s3, s4); s0 = s1; } else { peg$currPos = s0; @@ -2239,7 +2083,7 @@ module.exports = (function() { function peg$parseEscapedWhitespace() { var s0, s1; - var key = peg$currPos * 56 + 26, + var key = peg$currPos * 34 + 26, cached = peg$resultsCache[key]; if (cached) { @@ -2249,44 +2093,44 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c57) { - s1 = peg$c57; + if (input.substr(peg$currPos, 2) === peg$c56) { + s1 = peg$c56; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c58); } + if (peg$silentFails === 0) { peg$fail(peg$c57); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c59(); + s1 = peg$c58(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c60) { - s1 = peg$c60; + if (input.substr(peg$currPos, 2) === peg$c59) { + s1 = peg$c59; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c61); } + if (peg$silentFails === 0) { peg$fail(peg$c60); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c62(); + s1 = peg$c61(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c63) { - s1 = peg$c63; + if (input.substr(peg$currPos, 2) === peg$c62) { + s1 = peg$c62; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c64); } + if (peg$silentFails === 0) { peg$fail(peg$c63); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c65(); + s1 = peg$c64(); } s0 = s1; } @@ -2300,7 +2144,7 @@ module.exports = (function() { function peg$parseEscapedSpecialCharacter() { var s0, s1, s2; - var key = peg$currPos * 56 + 27, + var key = peg$currPos * 34 + 27, cached = peg$resultsCache[key]; if (cached) { @@ -2311,17 +2155,17 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c45; + s1 = peg$c44; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } + if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { s2 = peg$parseSpecialCharacter(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c49(s2); + s1 = peg$c48(s2); s0 = s1; } else { peg$currPos = s0; @@ -2340,7 +2184,7 @@ module.exports = (function() { function peg$parseEscapedKeyword() { var s0, s1, s2; - var key = peg$currPos * 56 + 28, + var key = peg$currPos * 34 + 28, cached = peg$resultsCache[key]; if (cached) { @@ -2351,41 +2195,41 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c45; + s1 = peg$c44; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } + if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c31) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { s2 = input.substr(peg$currPos, 2); peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c32); } + if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c34) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { s2 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c35); } + if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c37) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { s2 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$c37); } } } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c66(s2); + s1 = peg$c65(s2); s0 = s1; } else { peg$currPos = s0; @@ -2404,7 +2248,7 @@ module.exports = (function() { function peg$parseKeyword() { var s0; - var key = peg$currPos * 56 + 29, + var key = peg$currPos * 34 + 29, cached = peg$resultsCache[key]; if (cached) { @@ -2429,7 +2273,7 @@ module.exports = (function() { function peg$parseSpecialCharacter() { var s0; - var key = peg$currPos * 56 + 30, + var key = peg$currPos * 34 + 30, cached = peg$resultsCache[key]; if (cached) { @@ -2438,12 +2282,12 @@ module.exports = (function() { return cached.result; } - if (peg$c67.test(input.charAt(peg$currPos))) { + if (peg$c66.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c68); } + if (peg$silentFails === 0) { peg$fail(peg$c67); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -2454,7 +2298,7 @@ module.exports = (function() { function peg$parseRangeOperator() { var s0, s1; - var key = peg$currPos * 56 + 31, + var key = peg$currPos * 34 + 31, cached = peg$resultsCache[key]; if (cached) { @@ -2464,58 +2308,58 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c69) { - s1 = peg$c69; + if (input.substr(peg$currPos, 2) === peg$c68) { + s1 = peg$c68; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c70); } + if (peg$silentFails === 0) { peg$fail(peg$c69); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c71(); + s1 = peg$c70(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c72) { - s1 = peg$c72; + if (input.substr(peg$currPos, 2) === peg$c71) { + s1 = peg$c71; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } + if (peg$silentFails === 0) { peg$fail(peg$c72); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c74(); + s1 = peg$c73(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 60) { - s1 = peg$c75; + s1 = peg$c74; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c76); } + if (peg$silentFails === 0) { peg$fail(peg$c75); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c77(); + s1 = peg$c76(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 62) { - s1 = peg$c78; + s1 = peg$c77; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c79); } + if (peg$silentFails === 0) { peg$fail(peg$c78); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c80(); + s1 = peg$c79(); } s0 = s1; } @@ -2530,7 +2374,7 @@ module.exports = (function() { function peg$parseSpace() { var s0, s1; - var key = peg$currPos * 56 + 32, + var key = peg$currPos * 34 + 32, cached = peg$resultsCache[key]; if (cached) { @@ -2540,17 +2384,17 @@ module.exports = (function() { } peg$silentFails++; - if (peg$c82.test(input.charAt(peg$currPos))) { + if (peg$c81.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c83); } + if (peg$silentFails === 0) { peg$fail(peg$c82); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { peg$fail(peg$c80); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -2561,7 +2405,7 @@ module.exports = (function() { function peg$parseCursor() { var s0, s1, s2; - var key = peg$currPos * 56 + 33, + var key = peg$currPos * 34 + 33, cached = peg$resultsCache[key]; if (cached) { @@ -2572,23 +2416,23 @@ module.exports = (function() { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$c40(); + s1 = peg$c39(); if (s1) { s1 = void 0; } else { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 14) === peg$c84) { - s2 = peg$c84; + if (input.substr(peg$currPos, 14) === peg$c83) { + s2 = peg$c83; peg$currPos += 14; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c85); } + if (peg$silentFails === 0) { peg$fail(peg$c84); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c86(); + s1 = peg$c85(); s0 = s1; } else { peg$currPos = s0; @@ -2604,1325 +2448,8 @@ module.exports = (function() { return s0; } - function peg$parseLuceneOr() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 56 + 34, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseSpace(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseSpace(); - } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c87) { - s2 = peg$c87; - peg$currPos += 2; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c88); } - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseSpace(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseSpace(); - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c89(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneAnd() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 56 + 35, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseSpace(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseSpace(); - } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c90) { - s2 = peg$c90; - peg$currPos += 2; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c91); } - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseSpace(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseSpace(); - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c92(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 43) { - s1 = peg$c93; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c94); } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c92(); - } - s0 = s1; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneNot() { - var s0, s1; - - var key = peg$currPos * 56 + 36, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 45) { - s1 = peg$c95; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c96); } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c97(); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 33) { - s1 = peg$c98; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c99); } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c97(); - } - s0 = s1; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneQuery() { - var s0; - - var key = peg$currPos * 56 + 37, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseLuceneFieldQuery(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneValue(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneExists(); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneFieldQuery() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 56 + 38, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseLuceneLiteral(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c11; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c12); } - } - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parseLuceneValue(); - if (s5 !== peg$FAILED) { - s1 = [s1, s2, s3, s4, s5]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneValue() { - var s0; - - var key = peg$currPos * 56 + 39, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseLuceneRange(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneWildcard(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneRegex(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneFuzzy(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneProximity(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneBoost(); - } - } - } - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneExists() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 56 + 40, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c100) { - s1 = peg$c100; - peg$currPos += 8; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c101); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c11; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c12); } - } - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parseLuceneLiteral(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c102(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneRange() { - var s0, s1, s2, s3, s4, s5, s6; - - var key = peg$currPos * 56 + 41, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseRangeOperator(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseLuceneLiteral(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c103(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parseLuceneRangeStart(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseLuceneLiteral(); - if (s3 !== peg$FAILED) { - s4 = peg$parseLuceneTo(); - if (s4 !== peg$FAILED) { - s5 = peg$parseLuceneLiteral(); - if (s5 !== peg$FAILED) { - s6 = peg$parseLuceneRangeEnd(); - if (s6 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c103(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneWildcard() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 56 + 42, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseLuceneUnquotedCharacter(); - if (s2 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 42) { - s2 = peg$c54; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c55); } - } - } - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseLuceneUnquotedCharacter(); - if (s2 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 42) { - s2 = peg$c54; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c55); } - } - } - } - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 63) { - s2 = peg$c104; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c105); } - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseLuceneWildcard(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseLuceneWildcard(); - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c106(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneRegex() { - var s0, s1, s2, s3; - - var key = peg$currPos * 56 + 43, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 47) { - s1 = peg$c107; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c108); } - } - if (s1 !== peg$FAILED) { - s2 = []; - if (peg$c109.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c110); } - } - while (s3 !== peg$FAILED) { - s2.push(s3); - if (peg$c109.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c110); } - } - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 47) { - s3 = peg$c107; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c108); } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c111(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneFuzzy() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 56 + 44, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseLuceneUnquotedLiteral(); - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 126) { - s2 = peg$c112; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c113); } - } - if (s2 !== peg$FAILED) { - s3 = []; - if (peg$c114.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c115); } - } - while (s4 !== peg$FAILED) { - s3.push(s4); - if (peg$c114.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c115); } - } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c116(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneProximity() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 56 + 45, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseQuotedString(); - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 126) { - s2 = peg$c112; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c113); } - } - if (s2 !== peg$FAILED) { - s3 = []; - if (peg$c114.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c115); } - } - while (s4 !== peg$FAILED) { - s3.push(s4); - if (peg$c114.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c115); } - } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c117(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneBoost() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 56 + 46, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseLuceneLiteral(); - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 94) { - s2 = peg$c118; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c119); } - } - if (s2 !== peg$FAILED) { - s3 = []; - if (peg$c114.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c115); } - } - while (s4 !== peg$FAILED) { - s3.push(s4); - if (peg$c114.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c115); } - } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c120(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneLiteral() { - var s0; - - var key = peg$currPos * 56 + 47, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseQuotedString(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneUnquotedLiteral(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneUnquotedLiteral() { - var s0, s1; - - var key = peg$currPos * 56 + 48, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = []; - s1 = peg$parseLuceneUnquotedCharacter(); - if (s1 !== peg$FAILED) { - while (s1 !== peg$FAILED) { - s0.push(s1); - s1 = peg$parseLuceneUnquotedCharacter(); - } - } else { - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneUnquotedCharacter() { - var s0, s1, s2, s3; - - var key = peg$currPos * 56 + 49, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseEscapedWhitespace(); - if (s0 === peg$FAILED) { - s0 = peg$parseEscapedLuceneSpecialCharacter(); - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; - s2 = peg$parseLuceneSpecialCharacter(); - peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = void 0; - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - peg$silentFails++; - s3 = peg$parseLuceneKeyword(); - peg$silentFails--; - if (s3 === peg$FAILED) { - s2 = void 0; - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - if (input.length > peg$currPos) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c53); } - } - if (s3 !== peg$FAILED) { - s1 = [s1, s2, s3]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneKeyword() { - var s0; - - var key = peg$currPos * 56 + 50, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseOr(); - if (s0 === peg$FAILED) { - s0 = peg$parseAnd(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneOr(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneAnd(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneNot(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneTo(); - } - } - } - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseEscapedLuceneSpecialCharacter() { - var s0, s1, s2; - - var key = peg$currPos * 56 + 51, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c45; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseLuceneSpecialCharacter(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c121(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneSpecialCharacter() { - var s0; - - var key = peg$currPos * 56 + 52, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - if (input.charCodeAt(peg$currPos) === 43) { - s0 = peg$c93; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c94); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 45) { - s0 = peg$c95; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c96); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 61) { - s0 = peg$c122; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c123); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 62) { - s0 = peg$c78; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c79); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 60) { - s0 = peg$c75; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c76); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 33) { - s0 = peg$c98; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c99); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 40) { - s0 = peg$c6; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s0 = peg$c8; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c9); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 123) { - s0 = peg$c13; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s0 = peg$c15; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c16); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 91) { - s0 = peg$c124; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c125); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s0 = peg$c126; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c127); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 94) { - s0 = peg$c118; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c119); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s0 = peg$c41; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c42); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 126) { - s0 = peg$c112; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c113); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 42) { - s0 = peg$c54; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c55); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 63) { - s0 = peg$c104; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c105); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s0 = peg$c11; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c12); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 92) { - s0 = peg$c45; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 47) { - s0 = peg$c107; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c108); } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneTo() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 56 + 53, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseSpace(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseSpace(); - } - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c128) { - s2 = peg$c128; - peg$currPos += 2; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c129); } - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseSpace(); - if (s4 !== peg$FAILED) { - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseSpace(); - } - } else { - s3 = peg$FAILED; - } - if (s3 !== peg$FAILED) { - s1 = [s1, s2, s3]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneRangeStart() { - var s0; - - var key = peg$currPos * 56 + 54, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - if (input.charCodeAt(peg$currPos) === 91) { - s0 = peg$c124; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c125); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 123) { - s0 = peg$c13; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneRangeEnd() { - var s0; - - var key = peg$currPos * 56 + 55, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - if (input.charCodeAt(peg$currPos) === 93) { - s0 = peg$c126; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c127); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s0 = peg$c15; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c16); } - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - const { errorOnLuceneSyntax, parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; + const { parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; const buildLiteralNode = nodeTypes.literal.buildNode; const buildWildcardNode = nodeTypes.wildcard.buildNode; diff --git a/src/plugins/data/common/es_query/kuery/ast/ast.test.ts b/src/plugins/data/common/es_query/kuery/ast/ast.test.ts index 34e91787c6320..7d6e4c14f1502 100644 --- a/src/plugins/data/common/es_query/kuery/ast/ast.test.ts +++ b/src/plugins/data/common/es_query/kuery/ast/ast.test.ts @@ -6,12 +6,7 @@ * Side Public License, v 1. */ -import { - fromKueryExpression, - fromLiteralExpression, - toElasticsearchQuery, - doesKueryExpressionHaveLuceneSyntaxError, -} from './ast'; +import { fromKueryExpression, fromLiteralExpression, toElasticsearchQuery } from './ast'; import { nodeTypes } from '../node_types'; import { fields } from '../../../index_patterns/mocks'; import { IIndexPattern } from '../../../index_patterns'; @@ -376,81 +371,4 @@ describe('kuery AST API', () => { expect(result).toEqual(expected); }); }); - - describe('doesKueryExpressionHaveLuceneSyntaxError', () => { - test('should return true for Lucene ranges', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar: [1 TO 10]'); - expect(result).toEqual(true); - }); - - test('should return false for KQL ranges', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar < 1'); - expect(result).toEqual(false); - }); - - test('should return true for Lucene exists', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('_exists_: bar'); - expect(result).toEqual(true); - }); - - test('should return false for KQL exists', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar:*'); - expect(result).toEqual(false); - }); - - test('should return true for Lucene wildcards', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar: ba?'); - expect(result).toEqual(true); - }); - - test('should return false for KQL wildcards', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar: ba*'); - expect(result).toEqual(false); - }); - - test('should return true for Lucene regex', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar: /ba.*/'); - expect(result).toEqual(true); - }); - - test('should return true for Lucene fuzziness', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar: ba~'); - expect(result).toEqual(true); - }); - - test('should return true for Lucene proximity', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar: "ba"~2'); - expect(result).toEqual(true); - }); - - test('should return true for Lucene boosting', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar: ba^2'); - expect(result).toEqual(true); - }); - - test('should return true for Lucene + operator', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('+foo: bar'); - expect(result).toEqual(true); - }); - - test('should return true for Lucene - operators', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('-foo: bar'); - expect(result).toEqual(true); - }); - - test('should return true for Lucene && operators', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('foo: bar && baz: qux'); - expect(result).toEqual(true); - }); - - test('should return true for Lucene || operators', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('foo: bar || baz: qux'); - expect(result).toEqual(true); - }); - - test('should return true for mixed KQL/Lucene queries', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('foo: bar and (baz: qux || bag)'); - expect(result).toEqual(true); - }); - }); }); diff --git a/src/plugins/data/common/es_query/kuery/ast/ast.ts b/src/plugins/data/common/es_query/kuery/ast/ast.ts index 6ad76661edff4..5b22e3b3a3e0e 100644 --- a/src/plugins/data/common/es_query/kuery/ast/ast.ts +++ b/src/plugins/data/common/es_query/kuery/ast/ast.ts @@ -56,17 +56,6 @@ export const fromKueryExpression = ( } }; -export const doesKueryExpressionHaveLuceneSyntaxError = ( - expression: string | DslQuery -): boolean => { - try { - fromExpression(expression, { errorOnLuceneSyntax: true }, parseKuery); - return false; - } catch (e) { - return e.message.startsWith('Lucene'); - } -}; - /** * @params {String} indexPattern * @params {Object} config - contains the dateFormatTZ diff --git a/src/plugins/data/common/es_query/kuery/ast/kuery.peg b/src/plugins/data/common/es_query/kuery/ast/kuery.peg index e4d305ced7270..2e195ec7a618f 100644 --- a/src/plugins/data/common/es_query/kuery/ast/kuery.peg +++ b/src/plugins/data/common/es_query/kuery/ast/kuery.peg @@ -5,7 +5,7 @@ // Initialization block { - const { errorOnLuceneSyntax, parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; + const { parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; const buildLiteralNode = nodeTypes.literal.buildNode; const buildWildcardNode = nodeTypes.wildcard.buildNode; @@ -26,8 +26,7 @@ start } OrQuery - = &{ return errorOnLuceneSyntax; } LuceneQuery - / head:AndQuery tail:(Or query:AndQuery { return query; })+ { + = head:AndQuery tail:(Or query:AndQuery { return query; })+ { const nodes = [head, ...tail]; const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); if (cursor) return cursor; @@ -199,15 +198,12 @@ Value "value" Or "OR" = Space+ 'or'i Space+ - / &{ return errorOnLuceneSyntax; } LuceneOr And "AND" = Space+ 'and'i Space+ - / &{ return errorOnLuceneSyntax; } LuceneAnd Not "NOT" = 'not'i Space+ - / &{ return errorOnLuceneSyntax; } LuceneNot Literal "literal" = QuotedString / UnquotedLiteral @@ -306,109 +302,3 @@ Space "whitespace" Cursor = &{ return parseCursor; } '@kuery-cursor@' { return cursorSymbol; } - -// Temporary error rules (to help users transition from Lucene... should be removed at some point) - -LuceneOr - = Space* '||' Space* { - error('LuceneOr'); - } - -LuceneAnd - = Space* '&&' Space* { - error('LuceneAnd'); - } - / '+' { - error('LuceneAnd'); - } - -LuceneNot - = '-' { - error('LuceneNot'); - } - / '!' { - error('LuceneNot'); - } - -LuceneQuery - = LuceneFieldQuery - / LuceneValue - / LuceneExists - -LuceneFieldQuery - = LuceneLiteral Space* ':' Space* LuceneValue - -LuceneValue - = LuceneRange - / LuceneWildcard - / LuceneRegex - / LuceneFuzzy - / LuceneProximity - / LuceneBoost - -LuceneExists - = '_exists_' Space* ':' Space* LuceneLiteral { - error('LuceneExists'); - } - -LuceneRange - = RangeOperator Space* LuceneLiteral { - error('LuceneRange'); - } - / LuceneRangeStart Space* LuceneLiteral LuceneTo LuceneLiteral LuceneRangeEnd { - error('LuceneRange'); - } - -LuceneWildcard - = (LuceneUnquotedCharacter / '*')* '?' LuceneWildcard* { - error('LuceneWildcard'); - } - -LuceneRegex - = '/' [^/]* '/' { - error('LuceneRegex'); - } - -LuceneFuzzy - = LuceneUnquotedLiteral '~' [0-9]* { - error('LuceneFuzzy'); - } - -LuceneProximity - = QuotedString '~' [0-9]* { - error('LuceneProximity'); - } - -LuceneBoost - = LuceneLiteral '^' [0-9]* { - error('LuceneBoost'); - } - -LuceneLiteral - = QuotedString / LuceneUnquotedLiteral - -LuceneUnquotedLiteral - = LuceneUnquotedCharacter+ - -LuceneUnquotedCharacter - = EscapedWhitespace - / EscapedLuceneSpecialCharacter - / !LuceneSpecialCharacter !LuceneKeyword . - -LuceneKeyword - = Or / And / LuceneOr / LuceneAnd / LuceneNot / LuceneTo - -EscapedLuceneSpecialCharacter - = '\\' LuceneSpecialCharacter { return char; } - -LuceneSpecialCharacter - = '+' / '-' / '=' / '>' / '<' / '!' / '(' / ')' / '{' / '}' / '[' / ']' / '^' / '"' / '~' / '*' / '?' / ':' / '\\' / '/' - -LuceneTo - = Space+ 'TO' Space+ - -LuceneRangeStart - = '[' / '{' - -LuceneRangeEnd - = ']' / '}' diff --git a/src/plugins/data/common/es_query/kuery/types.ts b/src/plugins/data/common/es_query/kuery/types.ts index 3f787d5a41d3a..fe1496ead7ab6 100644 --- a/src/plugins/data/common/es_query/kuery/types.ts +++ b/src/plugins/data/common/es_query/kuery/types.ts @@ -21,7 +21,6 @@ export interface KueryParseOptions { }; startRule: string; allowLeadingWildcards: boolean; - errorOnLuceneSyntax: boolean; cursorSymbol?: string; parseCursor?: boolean; } diff --git a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx index 4142bccc09f40..88ccf6fe8a105 100644 --- a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx +++ b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx @@ -9,13 +9,10 @@ import dateMath from '@elastic/datemath'; import classNames from 'classnames'; import React, { useState } from 'react'; -import { i18n } from '@kbn/i18n'; import { - EuiButton, EuiFlexGroup, EuiFlexItem, - EuiLink, EuiSuperDatePicker, EuiFieldText, prettyDuration, @@ -23,12 +20,10 @@ import { } from '@elastic/eui'; // @ts-ignore import { EuiSuperUpdateButton, OnRefreshProps } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { Toast } from 'src/core/public'; import { IDataPluginServices, IIndexPattern, TimeRange, TimeHistoryContract, Query } from '../..'; -import { useKibana, toMountPoint, withKibana } from '../../../../kibana_react/public'; +import { useKibana, withKibana } from '../../../../kibana_react/public'; import QueryStringInputUI from './query_string_input'; -import { doesKueryExpressionHaveLuceneSyntaxError, UI_SETTINGS } from '../../../common'; +import { UI_SETTINGS } from '../../../common'; import { PersistedLog, getQueryLog } from '../../query'; import { NoDataPopover } from './no_data_popover'; @@ -72,9 +67,7 @@ export default function QueryBarTopRow(props: QueryBarTopRowProps) { const [isQueryInputFocused, setIsQueryInputFocused] = useState(false); const kibana = useKibana(); - const { uiSettings, notifications, storage, appName, docLinks } = kibana.services; - - const kueryQuerySyntaxLink: string = docLinks!.links.query.kueryQuerySyntax; + const { uiSettings, storage, appName } = kibana.services; const queryLanguage = props.query && props.query.language; const persistedLog: PersistedLog | undefined = React.useMemo( @@ -152,8 +145,6 @@ export default function QueryBarTopRow(props: QueryBarTopRowProps) { } function onSubmit({ query, dateRange }: { query?: Query; dateRange: TimeRange }) { - handleLuceneSyntaxWarning(); - if (props.timeHistory) { props.timeHistory.add(dateRange); } @@ -305,60 +296,6 @@ export default function QueryBarTopRow(props: QueryBarTopRowProps) { ); } - function handleLuceneSyntaxWarning() { - if (!props.query) return; - const { query, language } = props.query; - if ( - language === 'kuery' && - typeof query === 'string' && - (!storage || !storage.get('kibana.luceneSyntaxWarningOptOut')) && - doesKueryExpressionHaveLuceneSyntaxError(query) - ) { - const toast = notifications!.toasts.addWarning({ - title: i18n.translate('data.query.queryBar.luceneSyntaxWarningTitle', { - defaultMessage: 'Lucene syntax warning', - }), - text: toMountPoint( -
-

- - - - ), - }} - /> -

- - - onLuceneSyntaxWarningOptOut(toast)}> - - - - -
- ), - }); - } - } - - function onLuceneSyntaxWarningOptOut(toast: Toast) { - if (!storage) return; - storage.set('kibana.luceneSyntaxWarningOptOut', true); - notifications!.toasts.remove(toast); - } - const classes = classNames('kbnQueryBar', { 'kbnQueryBar--withDatePicker': props.showDatePicker, }); diff --git a/src/plugins/home/public/application/components/add_data/add_data.test.tsx b/src/plugins/home/public/application/components/add_data/add_data.test.tsx index 24635ef4aaa89..10119632c01b7 100644 --- a/src/plugins/home/public/application/components/add_data/add_data.test.tsx +++ b/src/plugins/home/public/application/components/add_data/add_data.test.tsx @@ -9,6 +9,7 @@ import React from 'react'; import { AddData } from './add_data'; import { shallowWithIntl } from '@kbn/test/jest'; +import { FeatureCatalogueEntry, FeatureCatalogueCategory } from '../../../services'; jest.mock('../app_navigation_handler', () => { return { @@ -28,9 +29,9 @@ beforeEach(() => { const addBasePathMock = jest.fn((path: string) => (path ? path : 'path')); -const mockFeatures = [ +const mockFeatures: FeatureCatalogueEntry[] = [ { - category: 'data', + category: FeatureCatalogueCategory.DATA, description: 'Ingest data from popular apps and services.', showOnHomePage: true, icon: 'indexOpen', @@ -40,7 +41,7 @@ const mockFeatures = [ title: 'Ingest data', }, { - category: 'admin', + category: FeatureCatalogueCategory.ADMIN, description: 'Add and manage your fleet of Elastic Agents and integrations.', showOnHomePage: true, icon: 'indexManagementApp', @@ -50,7 +51,7 @@ const mockFeatures = [ title: 'Add Elastic Agent', }, { - category: 'data', + category: FeatureCatalogueCategory.DATA, description: 'Import your own CSV, NDJSON, or log file', showOnHomePage: true, icon: 'document', diff --git a/src/plugins/home/public/application/components/add_data/add_data.tsx b/src/plugins/home/public/application/components/add_data/add_data.tsx index f7ff43db29d6e..e20abab271f29 100644 --- a/src/plugins/home/public/application/components/add_data/add_data.tsx +++ b/src/plugins/home/public/application/components/add_data/add_data.tsx @@ -11,8 +11,7 @@ import PropTypes from 'prop-types'; import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { METRIC_TYPE } from '@kbn/analytics'; -// @ts-expect-error untyped service -import { FeatureCatalogueEntry } from '../../services'; +import type { FeatureCatalogueEntry } from '../../../services'; import { createAppNavigationHandler } from '../app_navigation_handler'; // @ts-expect-error untyped component import { Synopsis } from '../synopsis'; diff --git a/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx b/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx index 6e28b295cd463..5b0728a8a4c71 100644 --- a/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx +++ b/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx @@ -9,6 +9,7 @@ import React from 'react'; import { ManageData } from './manage_data'; import { shallowWithIntl } from '@kbn/test/jest'; +import { FeatureCatalogueEntry, FeatureCatalogueCategory } from '../../../services'; jest.mock('../app_navigation_handler', () => { return { @@ -28,9 +29,9 @@ beforeEach(() => { const addBasePathMock = jest.fn((path: string) => (path ? path : 'path')); -const mockFeatures = [ +const mockFeatures: FeatureCatalogueEntry[] = [ { - category: 'admin', + category: FeatureCatalogueCategory.ADMIN, description: 'Control who has access and what tasks they can perform.', icon: 'securityApp', id: 'security', @@ -40,7 +41,7 @@ const mockFeatures = [ showOnHomePage: true, }, { - category: 'admin', + category: FeatureCatalogueCategory.ADMIN, description: 'Track the real-time health and performance of your deployment.', icon: 'monitoringApp', id: 'monitoring', @@ -50,7 +51,7 @@ const mockFeatures = [ showOnHomePage: true, }, { - category: 'admin', + category: FeatureCatalogueCategory.ADMIN, description: 'Save snapshots to a backup repository, and restore to recover index and cluster state.', icon: 'storage', @@ -61,7 +62,7 @@ const mockFeatures = [ showOnHomePage: true, }, { - category: 'admin', + category: FeatureCatalogueCategory.ADMIN, description: 'Define lifecycle policies to automatically perform operations as an index ages.', icon: 'indexSettings', id: 'index_lifecycle_management', diff --git a/src/plugins/home/public/application/components/manage_data/manage_data.tsx b/src/plugins/home/public/application/components/manage_data/manage_data.tsx index dff3f0b1af428..4ca695b8cb118 100644 --- a/src/plugins/home/public/application/components/manage_data/manage_data.tsx +++ b/src/plugins/home/public/application/components/manage_data/manage_data.tsx @@ -11,8 +11,7 @@ import PropTypes from 'prop-types'; import { EuiFlexGroup, EuiHorizontalRule, EuiSpacer, EuiTitle, EuiFlexItem } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { METRIC_TYPE } from '@kbn/analytics'; -// @ts-expect-error untyped service -import { FeatureCatalogueEntry } from '../../services'; +import { FeatureCatalogueEntry } from '../../../services'; import { createAppNavigationHandler } from '../app_navigation_handler'; // @ts-expect-error untyped component import { Synopsis } from '../synopsis'; diff --git a/src/plugins/home/public/mocks/index.ts b/src/plugins/home/public/mocks.ts similarity index 67% rename from src/plugins/home/public/mocks/index.ts rename to src/plugins/home/public/mocks.ts index 4df32a84ae6c5..32bec31153ba0 100644 --- a/src/plugins/home/public/mocks/index.ts +++ b/src/plugins/home/public/mocks.ts @@ -6,10 +6,10 @@ * Side Public License, v 1. */ -import { featureCatalogueRegistryMock } from '../services/feature_catalogue/feature_catalogue_registry.mock'; -import { environmentServiceMock } from '../services/environment/environment.mock'; -import { configSchema } from '../../config'; -import { tutorialServiceMock } from '../services/tutorials/tutorial_service.mock'; +import { featureCatalogueRegistryMock } from './services/feature_catalogue/feature_catalogue_registry.mock'; +import { environmentServiceMock } from './services/environment/environment.mock'; +import { configSchema } from '../config'; +import { tutorialServiceMock } from './services/tutorials/tutorial_service.mock'; const createSetupContract = () => ({ featureCatalogue: featureCatalogueRegistryMock.createSetup(), diff --git a/src/plugins/home/server/tutorials/googlecloud_logs/index.ts b/src/plugins/home/server/tutorials/gcp_logs/index.ts similarity index 71% rename from src/plugins/home/server/tutorials/googlecloud_logs/index.ts rename to src/plugins/home/server/tutorials/gcp_logs/index.ts index 0b1a2ad89b8e5..6aa6adb183418 100644 --- a/src/plugins/home/server/tutorials/googlecloud_logs/index.ts +++ b/src/plugins/home/server/tutorials/gcp_logs/index.ts @@ -18,27 +18,27 @@ import { TutorialSchema, } from '../../services/tutorials/lib/tutorials_registry_types'; -export function googlecloudLogsSpecProvider(context: TutorialContext): TutorialSchema { - const moduleName = 'googlecloud'; +export function gcpLogsSpecProvider(context: TutorialContext): TutorialSchema { + const moduleName = 'gcp'; const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { - id: 'googlecloudLogs', - name: i18n.translate('home.tutorials.googlecloudLogs.nameTitle', { + id: 'gcpLogs', + name: i18n.translate('home.tutorials.gcpLogs.nameTitle', { defaultMessage: 'Google Cloud logs', }), moduleName, category: TutorialsCategory.SECURITY_SOLUTION, - shortDescription: i18n.translate('home.tutorials.googlecloudLogs.shortDescription', { + shortDescription: i18n.translate('home.tutorials.gcpLogs.shortDescription', { defaultMessage: 'Collect Google Cloud audit, firewall, and VPC flow logs.', }), - longDescription: i18n.translate('home.tutorials.googlecloudLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.gcpLogs.longDescription', { defaultMessage: 'This is a module for Google Cloud logs. It supports reading audit, VPC flow, \ and firewall logs that have been exported from Stackdriver to a Google Pub/Sub \ topic sink. \ [Learn more]({learnMoreLink}).', values: { - learnMoreLink: '{config.docs.beats.filebeat}/filebeat-module-googlecloud.html', + learnMoreLink: '{config.docs.beats.filebeat}/filebeat-module-gcp.html', }, }), euiIconType: 'logoGoogleG', @@ -46,21 +46,18 @@ export function googlecloudLogsSpecProvider(context: TutorialContext): TutorialS dashboards: [ { id: '6576c480-73a2-11ea-a345-f985c61fe654', - linkLabel: i18n.translate( - 'home.tutorials.googlecloudLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Audit Logs Dashbaord', - } - ), + linkLabel: i18n.translate('home.tutorials.gcpLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'Audit Logs Dashbaord', + }), isOverview: true, }, ], exportedFields: { - documentationUrl: '{config.docs.beats.filebeat}/exported-fields-googlecloud.html', + documentationUrl: '{config.docs.beats.filebeat}/exported-fields-gcp.html', }, }, completionTimeMinutes: 10, - previewImagePath: '/plugins/home/assets/googlecloud_logs/screenshot.png', + previewImagePath: '/plugins/home/assets/gcp_logs/screenshot.png', onPrem: onPremInstructions(moduleName, platforms, context), elasticCloud: cloudInstructions(moduleName, platforms), onPremElasticCloud: onPremCloudInstructions(moduleName, platforms), diff --git a/src/plugins/home/server/tutorials/googlecloud_metrics/index.ts b/src/plugins/home/server/tutorials/gcp_metrics/index.ts similarity index 63% rename from src/plugins/home/server/tutorials/googlecloud_metrics/index.ts rename to src/plugins/home/server/tutorials/gcp_metrics/index.ts index 1e9dc64d60b57..8416ab105de96 100644 --- a/src/plugins/home/server/tutorials/googlecloud_metrics/index.ts +++ b/src/plugins/home/server/tutorials/gcp_metrics/index.ts @@ -18,25 +18,25 @@ import { TutorialSchema, } from '../../services/tutorials/lib/tutorials_registry_types'; -export function googlecloudMetricsSpecProvider(context: TutorialContext): TutorialSchema { - const moduleName = 'googlecloud'; +export function gcpMetricsSpecProvider(context: TutorialContext): TutorialSchema { + const moduleName = 'gcp'; return { - id: 'googlecloudMetrics', - name: i18n.translate('home.tutorials.googlecloudMetrics.nameTitle', { + id: 'gcpMetrics', + name: i18n.translate('home.tutorials.gcpMetrics.nameTitle', { defaultMessage: 'Google Cloud metrics', }), moduleName, category: TutorialsCategory.METRICS, - shortDescription: i18n.translate('home.tutorials.googlecloudMetrics.shortDescription', { + shortDescription: i18n.translate('home.tutorials.gcpMetrics.shortDescription', { defaultMessage: 'Fetch monitoring metrics from Google Cloud Platform using Stackdriver Monitoring API.', }), - longDescription: i18n.translate('home.tutorials.googlecloudMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.gcpMetrics.longDescription', { defaultMessage: - 'The `googlecloud` Metricbeat module fetches monitoring metrics from Google Cloud Platform using Stackdriver Monitoring API. \ + 'The `gcp` Metricbeat module fetches monitoring metrics from Google Cloud Platform using Stackdriver Monitoring API. \ [Learn more]({learnMoreLink}).', values: { - learnMoreLink: '{config.docs.beats.metricbeat}/metricbeat-module-googlecloud.html', + learnMoreLink: '{config.docs.beats.metricbeat}/metricbeat-module-gcp.html', }, }), euiIconType: 'logoGCP', @@ -45,21 +45,18 @@ export function googlecloudMetricsSpecProvider(context: TutorialContext): Tutori dashboards: [ { id: 'f40ee870-5e4a-11ea-a4f6-717338406083', - linkLabel: i18n.translate( - 'home.tutorials.googlecloudMetrics.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Google Cloud metrics dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.gcpMetrics.artifacts.dashboards.linkLabel', { + defaultMessage: 'Google Cloud metrics dashboard', + }), isOverview: true, }, ], exportedFields: { - documentationUrl: '{config.docs.beats.metricbeat}/exported-fields-googlecloud.html', + documentationUrl: '{config.docs.beats.metricbeat}/exported-fields-gcp.html', }, }, completionTimeMinutes: 10, - previewImagePath: '/plugins/home/assets/googlecloud_metrics/screenshot.png', + previewImagePath: '/plugins/home/assets/gcp_metrics/screenshot.png', onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), diff --git a/src/plugins/home/server/tutorials/register.ts b/src/plugins/home/server/tutorials/register.ts index 62b696aca7f43..bc8c85c43e691 100644 --- a/src/plugins/home/server/tutorials/register.ts +++ b/src/plugins/home/server/tutorials/register.ts @@ -42,8 +42,8 @@ import { etcdMetricsSpecProvider } from './etcd_metrics'; import { f5LogsSpecProvider } from './f5_logs'; import { fortinetLogsSpecProvider } from './fortinet_logs'; import { golangMetricsSpecProvider } from './golang_metrics'; -import { googlecloudLogsSpecProvider } from './googlecloud_logs'; -import { googlecloudMetricsSpecProvider } from './googlecloud_metrics'; +import { gcpLogsSpecProvider } from './gcp_logs'; +import { gcpMetricsSpecProvider } from './gcp_metrics'; import { gsuiteLogsSpecProvider } from './gsuite_logs'; import { haproxyLogsSpecProvider } from './haproxy_logs'; import { haproxyMetricsSpecProvider } from './haproxy_metrics'; @@ -192,7 +192,7 @@ export const builtInTutorials = [ oracleMetricsSpecProvider, iisMetricsSpecProvider, azureLogsSpecProvider, - googlecloudMetricsSpecProvider, + gcpMetricsSpecProvider, auditdLogsSpecProvider, barracudaLogsSpecProvider, bluecoatLogsSpecProvider, @@ -202,7 +202,7 @@ export const builtInTutorials = [ cylanceLogsSpecProvider, f5LogsSpecProvider, fortinetLogsSpecProvider, - googlecloudLogsSpecProvider, + gcpLogsSpecProvider, gsuiteLogsSpecProvider, haproxyLogsSpecProvider, icingaLogsSpecProvider, diff --git a/x-pack/plugins/fleet/server/routes/epm/handlers.ts b/x-pack/plugins/fleet/server/routes/epm/handlers.ts index 7237bdb296cd6..f466997f9e059 100644 --- a/x-pack/plugins/fleet/server/routes/epm/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/epm/handlers.ts @@ -228,9 +228,15 @@ export const installPackageFromRegistryHandler: RequestHandler< const savedObjectsClient = context.core.savedObjects.client; const esClient = context.core.elasticsearch.client.asCurrentUser; const { pkgkey } = request.params; - const { pkgName, pkgVersion } = splitPkgKey(pkgkey); - const installedPkg = await getInstallationObject({ savedObjectsClient, pkgName }); + + let pkgName: string | undefined; + let pkgVersion: string | undefined; + try { + const parsedPkgKey = splitPkgKey(pkgkey); + pkgName = parsedPkgKey.pkgName; + pkgVersion = parsedPkgKey.pkgVersion; + const res = await installPackage({ installSource: 'registry', savedObjectsClient, @@ -244,14 +250,17 @@ export const installPackageFromRegistryHandler: RequestHandler< return response.ok({ body }); } catch (e) { const defaultResult = await defaultIngestErrorHandler({ error: e, response }); - await handleInstallPackageFailure({ - savedObjectsClient, - error: e, - pkgName, - pkgVersion, - installedPkg, - esClient, - }); + if (pkgName && pkgVersion) { + const installedPkg = await getInstallationObject({ savedObjectsClient, pkgName }); + await handleInstallPackageFailure({ + savedObjectsClient, + error: e, + pkgName, + pkgVersion, + installedPkg, + esClient, + }); + } return defaultResult; } diff --git a/x-pack/plugins/fleet/server/saved_objects/index.ts b/x-pack/plugins/fleet/server/saved_objects/index.ts index 05e8fecdcaad1..923f4704aa652 100644 --- a/x-pack/plugins/fleet/server/saved_objects/index.ts +++ b/x-pack/plugins/fleet/server/saved_objects/index.ts @@ -22,20 +22,22 @@ import { } from '../constants'; import { - migratePackagePolicyToV7110, - migratePackagePolicyToV7120, - // @ts-expect-error -} from './security_solution'; -import { - migrateAgentToV7100, + migrateAgentActionToV7100, migrateAgentEventToV7100, migrateAgentPolicyToV7100, + migrateAgentToV7100, migrateEnrollmentApiKeysToV7100, migratePackagePolicyToV7100, migrateSettingsToV7100, - migrateAgentActionToV7100, } from './migrations/to_v7_10_0'; -import { migrateAgentToV7120, migrateAgentPolicyToV7120 } from './migrations/to_v7_12_0'; + +import { migratePackagePolicyToV7110 } from './migrations/to_v7_11_0'; + +import { + migrateAgentPolicyToV7120, + migrateAgentToV7120, + migratePackagePolicyToV7120, +} from './migrations/to_v7_12_0'; /* * Saved object types and mappings diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/index.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/index.ts new file mode 100644 index 0000000000000..bbdd3f14fe22f --- /dev/null +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { migratePackagePolicyToV7110 } from './to_v7_11_0'; +export { migratePackagePolicyToV7120 } from './to_v7_12_0'; diff --git a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_11_0.test.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.test.ts similarity index 98% rename from x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_11_0.test.ts rename to x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.test.ts index 251539113fee1..71a87793727a8 100644 --- a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_11_0.test.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.test.ts @@ -6,7 +6,9 @@ */ import { SavedObjectMigrationContext, SavedObjectUnsanitizedDoc } from 'kibana/server'; -import { PackagePolicy } from '../../../../../fleet/common'; + +import type { PackagePolicy } from '../../../../common'; + import { migratePackagePolicyToV7110 } from './to_v7_11_0'; describe('7.11.0 Endpoint Package Policy migration', () => { diff --git a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_11_0.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.ts similarity index 95% rename from x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_11_0.ts rename to x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.ts index d0dc4f547332a..445b84995353b 100644 --- a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_11_0.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.ts @@ -7,7 +7,8 @@ import { SavedObjectMigrationFn, SavedObjectUnsanitizedDoc } from 'kibana/server'; import { cloneDeep } from 'lodash'; -import { PackagePolicy } from '../../../../../fleet/common'; + +import type { PackagePolicy } from '../../../../common'; export const migratePackagePolicyToV7110: SavedObjectMigrationFn = ( packagePolicyDoc diff --git a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_12_0.test.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.test.ts similarity index 91% rename from x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_12_0.test.ts rename to x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.test.ts index 936d90cc1aa9c..e2f73270efbca 100644 --- a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_12_0.test.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.test.ts @@ -6,14 +6,15 @@ */ import { SavedObjectMigrationContext, SavedObjectUnsanitizedDoc } from 'kibana/server'; -import { PackagePolicy } from '../../../../../fleet/common'; -import { PolicyData, ProtectionModes } from '../../types'; + +import type { PackagePolicy } from '../../../../common'; + import { migratePackagePolicyToV7120 } from './to_v7_12_0'; describe('7.12.0 Endpoint Package Policy migration', () => { const migration = migratePackagePolicyToV7120; it('adds ransomware option and notification customization', () => { - const doc: SavedObjectUnsanitizedDoc = { + const doc = { id: 'mock-saved-object-id', attributes: { name: 'Some Policy Name', @@ -41,7 +42,6 @@ describe('7.12.0 Endpoint Package Policy migration', () => { policy: { value: { windows: { - // @ts-expect-error popup: { malware: { message: '', @@ -58,9 +58,7 @@ describe('7.12.0 Endpoint Package Policy migration', () => { type: ' nested', }; - expect( - migration(doc, {} as SavedObjectMigrationContext) as SavedObjectUnsanitizedDoc - ).toEqual({ + expect(migration(doc, {} as SavedObjectMigrationContext)).toEqual({ attributes: { name: 'Some Policy Name', package: { @@ -88,7 +86,7 @@ describe('7.12.0 Endpoint Package Policy migration', () => { value: { windows: { ransomware: { - mode: ProtectionModes.off, + mode: 'off', }, popup: { malware: { diff --git a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_12_0.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.ts similarity index 88% rename from x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_12_0.ts rename to x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.ts index 06d505a71025f..c10a89fea6b18 100644 --- a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_12_0.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.ts @@ -7,8 +7,8 @@ import { SavedObjectMigrationFn, SavedObjectUnsanitizedDoc } from 'kibana/server'; import { cloneDeep } from 'lodash'; -import { PackagePolicy } from '../../../../../fleet/common'; -import { ProtectionModes } from '../../types'; + +import type { PackagePolicy } from '../../../../common'; export const migratePackagePolicyToV7120: SavedObjectMigrationFn = ( packagePolicyDoc @@ -19,7 +19,7 @@ export const migratePackagePolicyToV7120: SavedObjectMigrationFn = ( agentDoc ) => { diff --git a/x-pack/plugins/infra/common/http_api/log_sources/log_source_configuration.ts b/x-pack/plugins/infra/common/http_api/log_sources/log_source_configuration.ts index ca640fb8f6cd0..ea723e12256eb 100644 --- a/x-pack/plugins/infra/common/http_api/log_sources/log_source_configuration.ts +++ b/x-pack/plugins/infra/common/http_api/log_sources/log_source_configuration.ts @@ -40,7 +40,7 @@ const logSourceMessageColumnConfigurationRT = rt.strict({ messageColumn: logSourceCommonColumnConfigurationRT, }); -const logSourceFieldColumnConfigurationRT = rt.strict({ +export const logSourceFieldColumnConfigurationRT = rt.strict({ fieldColumn: rt.intersection([ logSourceCommonColumnConfigurationRT, rt.strict({ diff --git a/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/memory.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/memory.ts index fef40b109941d..480fdc055a03f 100644 --- a/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/memory.ts +++ b/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/memory.ts @@ -8,5 +8,27 @@ import { MetricsUIAggregation } from '../../../types'; export const memory: MetricsUIAggregation = { - memory: { avg: { field: 'kubernetes.pod.memory.usage.node.pct' } }, + memory_with_limit: { + avg: { + field: 'kubernetes.pod.memory.usage.limit.pct', + }, + }, + memory_without_limit: { + avg: { + field: 'kubernetes.pod.memory.usage.node.pct', + }, + }, + memory: { + bucket_script: { + buckets_path: { + with_limit: 'memory_with_limit', + without_limit: 'memory_without_limit', + }, + script: { + source: 'params.with_limit > 0.0 ? params.with_limit : params.without_limit', + lang: 'painless', + }, + gap_policy: 'skip', + }, + }, }; diff --git a/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_memory_usage.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_memory_usage.ts index 9964d49e3a957..9c774e1b18ed0 100644 --- a/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_memory_usage.ts +++ b/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_memory_usage.ts @@ -25,9 +25,23 @@ export const podMemoryUsage: TSVBMetricModelCreator = ( metrics: [ { field: 'kubernetes.pod.memory.usage.node.pct', - id: 'avg-memory-usage', + id: 'avg-memory-without', type: 'avg', }, + { + field: 'kubernetes.pod.memory.usage.limit.pct', + id: 'avg-memory-with', + type: 'avg', + }, + { + id: 'memory-usage', + type: 'calculation', + variables: [ + { id: 'memory_with', name: 'with_limit', field: 'avg-memory-with' }, + { id: 'memory_without', name: 'without_limit', field: 'avg-memory-without' }, + ], + script: 'params.with_limit > 0.0 ? params.with_limit : params.without_limit', + }, ], }, ], diff --git a/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts b/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts index d8fb409f4eef3..bf7e497385f9a 100644 --- a/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts +++ b/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts @@ -18,7 +18,11 @@ import type { ISearchStrategy, PluginStart as DataPluginStart, } from '../../../../../../src/plugins/data/server'; -import { LogSourceColumnConfiguration } from '../../../common/http_api/log_sources'; +import { + LogSourceColumnConfiguration, + LogSourceConfigurationProperties, + logSourceFieldColumnConfigurationRT, +} from '../../../common/http_api/log_sources'; import { getLogEntryCursorFromHit, LogColumn, @@ -103,7 +107,7 @@ export const logEntriesSearchStrategyProvider = ({ params.size + 1, configuration.fields.timestamp, configuration.fields.tiebreaker, - messageFormattingRules.requiredFields, + getRequiredFields(configuration, messageFormattingRules, params.columns), params.query, params.highlightPhrase ), @@ -125,7 +129,12 @@ export const logEntriesSearchStrategyProvider = ({ const entries = rawResponse.hits.hits .slice(0, request.params.size) - .map(getLogEntryFromHit(configuration.logColumns, messageFormattingRules)); + .map( + getLogEntryFromHit( + request.params.columns ? request.params.columns : configuration.logColumns, + messageFormattingRules + ) + ); const sortDirection = getSortDirection(pickRequestCursor(request.params)); @@ -244,3 +253,26 @@ function getResponseCursors(entries: LogEntry[]) { return { topCursor, bottomCursor }; } + +const VIEW_IN_CONTEXT_FIELDS = ['log.file.path', 'host.name', 'container.id']; + +const getRequiredFields = ( + configuration: LogSourceConfigurationProperties, + messageFormattingRules: CompiledLogMessageFormattingRule, + columnOverrides?: LogSourceColumnConfiguration[] +): string[] => { + const columns = columnOverrides ? columnOverrides : configuration.logColumns; + + const fieldsFromColumns = columns.reduce((accumulatedFields, logColumn) => { + if (logSourceFieldColumnConfigurationRT.is(logColumn)) { + return [...accumulatedFields, logColumn.fieldColumn.field]; + } + return accumulatedFields; + }, []); + + const fieldsFromFormattingRules = messageFormattingRules.requiredFields; + + return Array.from( + new Set([...fieldsFromColumns, ...fieldsFromFormattingRules, ...VIEW_IN_CONTEXT_FIELDS]) + ); +}; diff --git a/x-pack/plugins/infra/server/services/log_entries/queries/log_entries.ts b/x-pack/plugins/infra/server/services/log_entries/queries/log_entries.ts index 613469fe75816..460703b22766f 100644 --- a/x-pack/plugins/infra/server/services/log_entries/queries/log_entries.ts +++ b/x-pack/plugins/infra/server/services/log_entries/queries/log_entries.ts @@ -20,8 +20,6 @@ import { } from '../../../utils/elasticsearch_runtime_types'; import { createSortClause, createTimeRangeFilterClauses } from './common'; -const CONTEXT_FIELDS = ['log.file.path', 'host.name', 'container.id']; - export const createGetLogEntriesQuery = ( logEntriesIndex: string, startTimestamp: number, @@ -36,7 +34,6 @@ export const createGetLogEntriesQuery = ( ): RequestParams.AsyncSearchSubmit> => { const sortDirection = getSortDirection(cursor); const highlightQuery = createHighlightQuery(highlightTerm, fields); - const fieldsWithContext = createFieldsWithContext(fields); return { index: logEntriesIndex, @@ -54,7 +51,7 @@ export const createGetLogEntriesQuery = ( ], }, }, - fields: fieldsWithContext, + fields, _source: false, ...createSortClause(sortDirection, timestampField, tiebreakerField), ...createSearchAfterClause(cursor), @@ -120,9 +117,6 @@ const createHighlightQuery = ( } }; -const createFieldsWithContext = (fields: string[]): string[] => - Array.from(new Set([...fields, ...CONTEXT_FIELDS])); - export const logEntryHitRT = rt.intersection([ commonHitFieldsRT, rt.type({ diff --git a/x-pack/plugins/maps/common/elasticsearch_util/elasticsearch_geo_utils.ts b/x-pack/plugins/maps/common/elasticsearch_util/elasticsearch_geo_utils.ts index f529f187c690c..f2a8b95f7b643 100644 --- a/x-pack/plugins/maps/common/elasticsearch_util/elasticsearch_geo_utils.ts +++ b/x-pack/plugins/maps/common/elasticsearch_util/elasticsearch_geo_utils.ts @@ -23,7 +23,7 @@ import { LAT_INDEX, } from '../constants'; import { getEsSpatialRelationLabel } from '../i18n_getters'; -import { Filter, FILTERS } from '../../../../../src/plugins/data/common'; +import { Filter, FilterMeta, FILTERS } from '../../../../../src/plugins/data/common'; import { MapExtent } from '../descriptor_types'; const SPATIAL_FILTER_TYPE = FILTERS.SPATIAL_FILTER; @@ -49,6 +49,12 @@ interface GeoShapeQueryBody { indexed_shape?: PreIndexedShape; } +// Index signature explicitly states that anything stored in an object using a string conforms to the structure +// problem is that Elasticsearch signature also allows for other string keys to conform to other structures, like 'ignore_unmapped' +// Use intersection type to exclude certain properties from the index signature +// https://basarat.gitbook.io/typescript/type-system/index-signatures#excluding-certain-properties-from-the-index-signature +type GeoShapeQuery = { ignore_unmapped: boolean } & { [geoFieldName: string]: GeoShapeQueryBody }; + export type GeoFilter = Filter & { geo_bounding_box?: { [geoFieldName: string]: ESBBox; @@ -57,9 +63,7 @@ export type GeoFilter = Filter & { distance: string; [geoFieldName: string]: Position | { lat: number; lon: number } | string; }; - geo_shape?: { - [geoFieldName: string]: GeoShapeQueryBody; - }; + geo_shape?: GeoShapeQuery; }; export interface PreIndexedShape { @@ -375,7 +379,7 @@ export function createSpatialFilterWithGeometry({ geoFieldName: string; geoFieldType: ES_GEO_FIELD_TYPE; relation: ES_SPATIAL_RELATIONS; -}) { +}): GeoFilter { ensureGeoField(geoFieldType); const isGeoPoint = geoFieldType === ES_GEO_FIELD_TYPE.GEO_POINT; @@ -385,12 +389,13 @@ export function createSpatialFilterWithGeometry({ defaultMessage: 'in', }) : getEsSpatialRelationLabel(relation); - const meta = { + const meta: FilterMeta = { type: SPATIAL_FILTER_TYPE, negate: false, index: indexPatternId, key: geoFieldName, alias: `${geoFieldName} ${relationLabel} ${geometryLabel}`, + disabled: false, }; const shapeQuery: GeoShapeQueryBody = { @@ -406,6 +411,9 @@ export function createSpatialFilterWithGeometry({ return { meta, + // Currently no way to create an object with exclude property from index signature + // typescript error for "ignore_unmapped is not assignable to type 'GeoShapeQueryBody'" expected" + // @ts-expect-error geo_shape: { ignore_unmapped: true, [geoFieldName]: shapeQuery, @@ -425,8 +433,8 @@ export function createDistanceFilterWithMeta({ geoFieldName: string; indexPatternId: string; point: Position; -}) { - const meta = { +}): GeoFilter { + const meta: FilterMeta = { type: SPATIAL_FILTER_TYPE, negate: false, index: indexPatternId, @@ -441,6 +449,7 @@ export function createDistanceFilterWithMeta({ pointLabel: point.join(', '), }, }), + disabled: false, }; return { diff --git a/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts b/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts index d3a4fa4101ac9..d795315acbf50 100644 --- a/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts +++ b/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts @@ -298,10 +298,12 @@ export class BlendedVectorLayer extends VectorLayer implements IVectorLayer { this.getSource(), this.getCurrentStyle() ); + const source = this.getSource(); const canSkipFetch = await canSkipSourceUpdate({ - source: this.getSource(), + source, prevDataRequest: this.getDataRequest(dataRequestId), nextMeta: searchFilters, + extentAware: source.isFilterByMapBounds(), }); let activeSource; diff --git a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.test.tsx b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.test.tsx index b2bb6a94197f0..01902d1fec89d 100644 --- a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.test.tsx +++ b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.test.tsx @@ -37,7 +37,8 @@ const defaultConfig = { function createLayer( layerOptions: Partial = {}, - sourceOptions: Partial = {} + sourceOptions: Partial = {}, + isTimeAware: boolean = false ): TiledVectorLayer { const sourceDescriptor: TiledSingleLayerVectorSourceDescriptor = { type: SOURCE_TYPES.MVT_SINGLE_LAYER, @@ -47,6 +48,14 @@ function createLayer( ...sourceOptions, }; const mvtSource = new MVTSingleLayerVectorSource(sourceDescriptor); + if (isTimeAware) { + mvtSource.isTimeAware = async () => { + return true; + }; + mvtSource.getApplyGlobalTime = () => { + return true; + }; + } const defaultLayerOptions = { ...layerOptions, @@ -107,62 +116,75 @@ describe('syncData', () => { }); it('Should not resync when no changes to source params', async () => { - const layer1: TiledVectorLayer = createLayer({}, {}); - const syncContext1 = new MockSyncContext({ dataFilters: {} }); - - await layer1.syncData(syncContext1); - const dataRequestDescriptor: DataRequestDescriptor = { data: { ...defaultConfig }, dataId: 'source', }; - const layer2: TiledVectorLayer = createLayer( + const layer: TiledVectorLayer = createLayer( { __dataRequests: [dataRequestDescriptor], }, {} ); - const syncContext2 = new MockSyncContext({ dataFilters: {} }); - await layer2.syncData(syncContext2); + const syncContext = new MockSyncContext({ dataFilters: {} }); + await layer.syncData(syncContext); // @ts-expect-error - sinon.assert.notCalled(syncContext2.startLoading); + sinon.assert.notCalled(syncContext.startLoading); // @ts-expect-error - sinon.assert.notCalled(syncContext2.stopLoading); + sinon.assert.notCalled(syncContext.stopLoading); + }); + + it('Should resync when changes to syncContext', async () => { + const dataRequestDescriptor: DataRequestDescriptor = { + data: { ...defaultConfig }, + dataId: 'source', + }; + const layer: TiledVectorLayer = createLayer( + { + __dataRequests: [dataRequestDescriptor], + }, + {}, + true + ); + const syncContext = new MockSyncContext({ + dataFilters: { + timeFilters: { + from: 'now', + to: '30m', + mode: 'relative', + }, + }, + }); + await layer.syncData(syncContext); + // @ts-expect-error + sinon.assert.calledOnce(syncContext.startLoading); + // @ts-expect-error + sinon.assert.calledOnce(syncContext.stopLoading); }); describe('Should resync when changes to source params: ', () => { - [ - { layerName: 'barfoo' }, - { urlTemplate: 'https://sub.example.com/{z}/{x}/{y}.pbf' }, - { minSourceZoom: 1 }, - { maxSourceZoom: 12 }, - ].forEach((changes) => { + [{ layerName: 'barfoo' }, { minSourceZoom: 1 }, { maxSourceZoom: 12 }].forEach((changes) => { it(`change in ${Object.keys(changes).join(',')}`, async () => { - const layer1: TiledVectorLayer = createLayer({}, {}); - const syncContext1 = new MockSyncContext({ dataFilters: {} }); - - await layer1.syncData(syncContext1); - const dataRequestDescriptor: DataRequestDescriptor = { data: defaultConfig, dataId: 'source', }; - const layer2: TiledVectorLayer = createLayer( + const layer: TiledVectorLayer = createLayer( { __dataRequests: [dataRequestDescriptor], }, changes ); - const syncContext2 = new MockSyncContext({ dataFilters: {} }); - await layer2.syncData(syncContext2); + const syncContext = new MockSyncContext({ dataFilters: {} }); + await layer.syncData(syncContext); // @ts-expect-error - sinon.assert.calledOnce(syncContext2.startLoading); + sinon.assert.calledOnce(syncContext.startLoading); // @ts-expect-error - sinon.assert.calledOnce(syncContext2.stopLoading); + sinon.assert.calledOnce(syncContext.stopLoading); // @ts-expect-error - const call = syncContext2.stopLoading.getCall(0); + const call = syncContext.stopLoading.getCall(0); expect(call.args[2]).toEqual({ ...defaultConfig, ...changes }); }); }); diff --git a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx index 477b17ae03d7b..f2fe916953801 100644 --- a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx +++ b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx @@ -23,6 +23,7 @@ import { VectorSourceRequestMeta, } from '../../../../common/descriptor_types'; import { MVTSingleLayerVectorSourceConfig } from '../../sources/mvt_single_layer_vector_source/types'; +import { canSkipSourceUpdate } from '../../util/can_skip_fetch'; export class TiledVectorLayer extends VectorLayer { static type = LAYER_TYPE.TILED_VECTOR; @@ -68,18 +69,22 @@ export class TiledVectorLayer extends VectorLayer { this._style as IVectorStyle ); const prevDataRequest = this.getSourceDataRequest(); - - const templateWithMeta = await this._source.getUrlTemplateWithMeta(searchFilters); + const dataRequest = await this._source.getUrlTemplateWithMeta(searchFilters); if (prevDataRequest) { const data: MVTSingleLayerVectorSourceConfig = prevDataRequest.getData() as MVTSingleLayerVectorSourceConfig; if (data) { - const canSkipBecauseNoChanges = + const noChangesInSourceState: boolean = data.layerName === this._source.getLayerName() && data.minSourceZoom === this._source.getMinZoom() && - data.maxSourceZoom === this._source.getMaxZoom() && - data.urlTemplate === templateWithMeta.urlTemplate; - - if (canSkipBecauseNoChanges) { + data.maxSourceZoom === this._source.getMaxZoom(); + const noChangesInSearchState: boolean = await canSkipSourceUpdate({ + extentAware: false, // spatial extent knowledge is already fully automated by tile-loading based on pan-zooming + source: this.getSource(), + prevDataRequest, + nextMeta: searchFilters, + }); + const canSkip = noChangesInSourceState && noChangesInSearchState; + if (canSkip) { return null; } } @@ -87,7 +92,7 @@ export class TiledVectorLayer extends VectorLayer { startLoading(SOURCE_DATA_REQUEST_ID, requestToken, searchFilters); try { - stopLoading(SOURCE_DATA_REQUEST_ID, requestToken, templateWithMeta, {}); + stopLoading(SOURCE_DATA_REQUEST_ID, requestToken, dataRequest, {}); } catch (error) { onLoadError(SOURCE_DATA_REQUEST_ID, requestToken, error.message); } diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/utils.tsx b/x-pack/plugins/maps/public/classes/layers/vector_layer/utils.tsx index 91bdd74c158f9..e49339b6250b4 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/utils.tsx +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/utils.tsx @@ -73,6 +73,7 @@ export async function syncVectorSource({ source, prevDataRequest, nextMeta: requestMeta, + extentAware: source.isFilterByMapBounds(), }); if (canSkipFetch) { return { diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx b/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx index b21bff9922671..104d0b56578d1 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx @@ -332,6 +332,7 @@ export class VectorLayer extends AbstractLayer implements IVectorLayer { source: joinSource, prevDataRequest, nextMeta: searchFilters, + extentAware: false, // join-sources are term-aggs that are spatially unaware (e.g. ESTermSource/TableSource). }); if (canSkipFetch) { return { diff --git a/x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts b/x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts index 961ca88719488..5f81a74ab03ce 100644 --- a/x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts +++ b/x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts @@ -29,7 +29,7 @@ export interface FeatureGeometry { } export interface RenderTooltipContentParams { - addFilters(filter: object): void; + addFilters(filter: object, actionId: string): void; closeTooltip(): void; features: TooltipFeature[]; isLocked: boolean; diff --git a/x-pack/plugins/maps/public/classes/util/can_skip_fetch.test.js b/x-pack/plugins/maps/public/classes/util/can_skip_fetch.test.js index ce58cb7d019ed..1901b15e8f350 100644 --- a/x-pack/plugins/maps/public/classes/util/can_skip_fetch.test.js +++ b/x-pack/plugins/maps/public/classes/util/can_skip_fetch.test.js @@ -135,6 +135,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(true); @@ -154,6 +155,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(true); @@ -173,6 +175,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(false); @@ -189,6 +192,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(false); @@ -219,6 +223,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(false); @@ -238,6 +243,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(false); @@ -257,6 +263,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(false); @@ -273,6 +280,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(false); diff --git a/x-pack/plugins/maps/public/classes/util/can_skip_fetch.ts b/x-pack/plugins/maps/public/classes/util/can_skip_fetch.ts index 1b2fae413d909..575c99432f508 100644 --- a/x-pack/plugins/maps/public/classes/util/can_skip_fetch.ts +++ b/x-pack/plugins/maps/public/classes/util/can_skip_fetch.ts @@ -55,14 +55,15 @@ export async function canSkipSourceUpdate({ source, prevDataRequest, nextMeta, + extentAware, }: { source: ISource; prevDataRequest: DataRequest | undefined; nextMeta: DataMeta; + extentAware: boolean; }): Promise { const timeAware = await source.isTimeAware(); const refreshTimerAware = await source.isRefreshTimerAware(); - const extentAware = source.isFilterByMapBounds(); const isFieldAware = source.isFieldAware(); const isQueryAware = source.isQueryAware(); const isGeoGridPrecisionAware = source.isGeoGridPrecisionAware(); @@ -132,11 +133,12 @@ export async function canSkipSourceUpdate({ } let updateDueToPrecisionChange = false; + let updateDueToExtentChange = false; + if (isGeoGridPrecisionAware) { updateDueToPrecisionChange = !_.isEqual(prevMeta.geogridPrecision, nextMeta.geogridPrecision); } - let updateDueToExtentChange = false; if (extentAware) { updateDueToExtentChange = updateDueToExtent(prevMeta, nextMeta); } diff --git a/x-pack/plugins/maps/public/connected_components/map_container/map_container.tsx b/x-pack/plugins/maps/public/connected_components/map_container/map_container.tsx index 390a8eebfad58..622aeae3cbb87 100644 --- a/x-pack/plugins/maps/public/connected_components/map_container/map_container.tsx +++ b/x-pack/plugins/maps/public/connected_components/map_container/map_container.tsx @@ -37,7 +37,7 @@ import 'mapbox-gl/dist/mapbox-gl.css'; const RENDER_COMPLETE_EVENT = 'renderComplete'; export interface Props { - addFilters: ((filters: Filter[]) => Promise) | null; + addFilters: ((filters: Filter[], actionId: string) => Promise) | null; getFilterActions?: () => Promise; getActionContext?: () => ActionExecutionContext; onSingleValueTrigger?: (actionId: string, key: string, value: RawValue) => void; diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_circle.ts b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_circle.ts index a4b076c0dd7f0..f0df797582bef 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_circle.ts +++ b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_circle.ts @@ -11,12 +11,17 @@ import turfDistance from '@turf/distance'; // @ts-expect-error import turfCircle from '@turf/circle'; +import { Position } from 'geojson'; + +export interface DrawCircleProperties { + center: Position; + radiusKm: number; +} type DrawCircleState = { circle: { - properties: { - center: {} | null; - radiusKm: number; + properties: Omit & { + center: Position | null; }; id: string | number; incomingCoords: (coords: unknown[]) => void; diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_control.js b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_control.tsx similarity index 63% rename from x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_control.js rename to x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_control.tsx index aaec7ecb2b34f..f68875dc81394 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_control.js +++ b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_control.tsx @@ -6,11 +6,18 @@ */ import _ from 'lodash'; -import React from 'react'; -import { DRAW_TYPE } from '../../../../common/constants'; +import React, { Component } from 'react'; +// @ts-expect-error import MapboxDraw from '@mapbox/mapbox-gl-draw'; +// @ts-expect-error import DrawRectangle from 'mapbox-gl-draw-rectangle-mode'; -import { DrawCircle } from './draw_circle'; +import { Map as MbMap } from 'mapbox-gl'; +import { i18n } from '@kbn/i18n'; +import { Filter } from 'src/plugins/data/public'; +import { Feature, Polygon } from 'geojson'; +import { DRAW_TYPE, ES_GEO_FIELD_TYPE, ES_SPATIAL_RELATIONS } from '../../../../common/constants'; +import { DrawState } from '../../../../common/descriptor_types'; +import { DrawCircle, DrawCircleProperties } from './draw_circle'; import { createDistanceFilterWithMeta, createSpatialFilterWithGeometry, @@ -18,6 +25,7 @@ import { roundCoordinates, } from '../../../../common/elasticsearch_util'; import { DrawTooltip } from './draw_tooltip'; +import { getToasts } from '../../../kibana_services'; const DRAW_RECTANGLE = 'draw_rectangle'; const DRAW_CIRCLE = 'draw_circle'; @@ -26,15 +34,21 @@ const mbDrawModes = MapboxDraw.modes; mbDrawModes[DRAW_RECTANGLE] = DrawRectangle; mbDrawModes[DRAW_CIRCLE] = DrawCircle; -export class DrawControl extends React.Component { - constructor() { - super(); - this._mbDrawControl = new MapboxDraw({ - displayControlsDefault: false, - modes: mbDrawModes, - }); - this._mbDrawControlAdded = false; - } +export interface Props { + addFilters: (filters: Filter[], actionId: string) => Promise; + disableDrawState: () => void; + drawState?: DrawState; + isDrawingFilter: boolean; + mbMap: MbMap; +} + +export class DrawControl extends Component { + private _isMounted = false; + private _mbDrawControlAdded = false; + private _mbDrawControl = new MapboxDraw({ + displayControlsDefault: false, + modes: mbDrawModes, + }); componentDidUpdate() { this._syncDrawControl(); @@ -63,14 +77,19 @@ export class DrawControl extends React.Component { } }, 0); - _onDraw = async (e) => { - if (!e.features.length) { + _onDraw = async (e: { features: Feature[] }) => { + if ( + !e.features.length || + !this.props.drawState || + !this.props.drawState.geoFieldName || + !this.props.drawState.indexPatternId + ) { return; } - let filter; + let filter: Filter | undefined; if (this.props.drawState.drawType === DRAW_TYPE.DISTANCE) { - const circle = e.features[0]; + const circle = e.features[0] as Feature & { properties: DrawCircleProperties }; const distanceKm = _.round( circle.properties.radiusKm, circle.properties.radiusKm > 10 ? 0 : 2 @@ -85,7 +104,7 @@ export class DrawControl extends React.Component { precision = 3; } filter = createDistanceFilterWithMeta({ - alias: this.props.drawState.filterLabel, + alias: this.props.drawState.filterLabel ? this.props.drawState.filterLabel : '', distanceKm, geoFieldName: this.props.drawState.geoFieldName, indexPatternId: this.props.drawState.indexPatternId, @@ -95,7 +114,7 @@ export class DrawControl extends React.Component { ], }); } else { - const geometry = e.features[0].geometry; + const geometry = e.features[0].geometry as Polygon; // MapboxDraw returns coordinates with 12 decimals. Round to a more reasonable number roundCoordinates(geometry.coordinates); @@ -106,24 +125,34 @@ export class DrawControl extends React.Component { : geometry, indexPatternId: this.props.drawState.indexPatternId, geoFieldName: this.props.drawState.geoFieldName, - geoFieldType: this.props.drawState.geoFieldType, - geometryLabel: this.props.drawState.geometryLabel, - relation: this.props.drawState.relation, + geoFieldType: this.props.drawState.geoFieldType + ? this.props.drawState.geoFieldType + : ES_GEO_FIELD_TYPE.GEO_POINT, + geometryLabel: this.props.drawState.geometryLabel ? this.props.drawState.geometryLabel : '', + relation: this.props.drawState.relation + ? this.props.drawState.relation + : ES_SPATIAL_RELATIONS.INTERSECTS, }); } try { - await this.props.addFilters([filter], this.props.drawState.actionId); + await this.props.addFilters([filter!], this.props.drawState.actionId); } catch (error) { - // TODO notify user why filter was not created - console.error(error); + getToasts().addWarning( + i18n.translate('xpack.maps.drawControl.unableToCreatFilter', { + defaultMessage: `Unable to create filter, error: '{errorMsg}'.`, + values: { + errorMsg: error.message, + }, + }) + ); } finally { this.props.disableDrawState(); } }; _removeDrawControl() { - if (!this.props.mbMap || !this._mbDrawControlAdded) { + if (!this._mbDrawControlAdded) { return; } @@ -134,7 +163,7 @@ export class DrawControl extends React.Component { } _updateDrawControl() { - if (!this.props.mbMap) { + if (!this.props.drawState) { return; } @@ -159,7 +188,7 @@ export class DrawControl extends React.Component { } render() { - if (!this.props.mbMap || !this.props.isDrawingFilter) { + if (!this.props.isDrawingFilter || !this.props.drawState) { return null; } diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_tooltip.js b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_tooltip.tsx similarity index 84% rename from x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_tooltip.js rename to x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_tooltip.tsx index 01e90d8e2daf4..099f409c91c21 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_tooltip.js +++ b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_tooltip.tsx @@ -6,25 +6,35 @@ */ import _ from 'lodash'; -import React, { Component } from 'react'; +import React, { Component, RefObject } from 'react'; import { EuiPopover, EuiText } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { Map as MbMap } from 'mapbox-gl'; import { DRAW_TYPE } from '../../../../common/constants'; +import { DrawState } from '../../../../common/descriptor_types'; const noop = () => {}; -export class DrawTooltip extends Component { - state = { +interface Props { + mbMap: MbMap; + drawState: DrawState; +} + +interface State { + x?: number; + y?: number; + isOpen: boolean; +} + +export class DrawTooltip extends Component { + private readonly _popoverRef: RefObject = React.createRef(); + + state: State = { x: undefined, y: undefined, isOpen: false, }; - constructor(props) { - super(props); - this._popoverRef = React.createRef(); - } - componentDidMount() { this.props.mbMap.on('mousemove', this._updateTooltipLocation); this.props.mbMap.on('mouseout', this._hideTooltip); @@ -43,6 +53,10 @@ export class DrawTooltip extends Component { } render() { + if (this.state.x === undefined || this.state.y === undefined) { + return null; + } + let instructions; if (this.props.drawState.drawType === DRAW_TYPE.BOUNDS) { instructions = i18n.translate('xpack.maps.drawTooltip.boundsInstructions', { diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/index.js b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/index.ts similarity index 63% rename from x-pack/plugins/maps/public/connected_components/mb_map/draw_control/index.js rename to x-pack/plugins/maps/public/connected_components/mb_map/draw_control/index.ts index 9324ebc0c9fe9..cc2f560c63d24 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/index.js +++ b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/index.ts @@ -5,19 +5,22 @@ * 2.0. */ +import { AnyAction } from 'redux'; +import { ThunkDispatch } from 'redux-thunk'; import { connect } from 'react-redux'; import { DrawControl } from './draw_control'; import { updateDrawState } from '../../../actions'; import { getDrawState, isDrawingFilter } from '../../../selectors/map_selectors'; +import { MapStoreState } from '../../../reducers/store'; -function mapStateToProps(state = {}) { +function mapStateToProps(state: MapStoreState) { return { isDrawingFilter: isDrawingFilter(state), drawState: getDrawState(state), }; } -function mapDispatchToProps(dispatch) { +function mapDispatchToProps(dispatch: ThunkDispatch) { return { disableDrawState() { dispatch(updateDrawState(null)); @@ -25,5 +28,5 @@ function mapDispatchToProps(dispatch) { }; } -const connectedDrawControl = connect(mapStateToProps, mapDispatchToProps)(DrawControl); -export { connectedDrawControl as DrawControl }; +const connected = connect(mapStateToProps, mapDispatchToProps)(DrawControl); +export { connected as DrawControl }; diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_geometry_filter_form.js b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_geometry_filter_form.js index fa07460a584a7..3950c6ef124be 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_geometry_filter_form.js +++ b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_geometry_filter_form.js @@ -9,6 +9,7 @@ import React, { Component } from 'react'; import { i18n } from '@kbn/i18n'; import { URL_MAX_LENGTH } from '../../../../../../../src/core/public'; +import { ACTION_GLOBAL_APPLY_FILTER } from '../../../../../../../src/plugins/data/public'; import { createSpatialFilterWithGeometry } from '../../../../common/elasticsearch_util'; import { GEO_JSON_TYPE } from '../../../../common/constants'; import { GeometryFilterForm } from '../../../components/geometry_filter_form'; @@ -90,7 +91,7 @@ export class FeatureGeometryFilterForm extends Component { return; } - this.props.addFilters([filter]); + this.props.addFilters([filter], ACTION_GLOBAL_APPLY_FILTER); this.props.onClose(); }; diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_properties.js b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_properties.js index 996c530dcae94..2bd1d5c9cacf5 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_properties.js +++ b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_properties.js @@ -192,7 +192,7 @@ export class FeatureProperties extends React.Component { onClick={async () => { this.props.onCloseTooltip(); const filters = await tooltipProperty.getESFilters(); - this.props.addFilters(filters); + this.props.addFilters(filters, ACTION_GLOBAL_APPLY_FILTER); }} aria-label={i18n.translate('xpack.maps.tooltip.filterOnPropertyAriaLabel', { defaultMessage: 'Filter on property', diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/mb_map.tsx b/x-pack/plugins/maps/public/connected_components/mb_map/mb_map.tsx index 5dbe2f97ee6d3..fae89a0484f11 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/mb_map.tsx +++ b/x-pack/plugins/maps/public/connected_components/mb_map/mb_map.tsx @@ -17,7 +17,6 @@ import sprites2 from '@elastic/maki/dist/sprite@2.png'; import { Adapters } from 'src/plugins/inspector/public'; import { Filter } from 'src/plugins/data/public'; import { ActionExecutionContext, Action } from 'src/plugins/ui_actions/public'; -// @ts-expect-error import { DrawControl } from './draw_control'; import { ScaleControl } from './scale_control'; // @ts-expect-error @@ -67,7 +66,7 @@ export interface Props { clearMouseCoordinates: () => void; clearGoto: () => void; setMapInitError: (errorMessage: string) => void; - addFilters: ((filters: Filter[]) => Promise) | null; + addFilters: ((filters: Filter[], actionId: string) => Promise) | null; getFilterActions?: () => Promise; getActionContext?: () => ActionExecutionContext; onSingleValueTrigger?: (actionId: string, key: string, value: RawValue) => void; @@ -418,7 +417,9 @@ export class MBMap extends Component { let tooltipControl; let scaleControl; if (this.state.mbMap) { - drawControl = ; + drawControl = this.props.addFilters ? ( + + ) : null; tooltipControl = !this.props.settings.disableTooltipControl ? ( ( ), diff --git a/x-pack/plugins/reporting/public/components/reporting_panel_content.tsx b/x-pack/plugins/reporting/public/components/reporting_panel_content.tsx index 6673aded2ecbe..6f6cf2dc9351b 100644 --- a/x-pack/plugins/reporting/public/components/reporting_panel_content.tsx +++ b/x-pack/plugins/reporting/public/components/reporting_panel_content.tsx @@ -223,7 +223,17 @@ class ReportingPanelContentUi extends Component { text: toMountPoint( + + + ), + }} /> ), 'data-test-subj': 'queueReportSuccess', diff --git a/x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/index.ts b/x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/index.ts index 0b59170dfc778..81edb51e41458 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/index.ts @@ -38,11 +38,11 @@ export interface MatrixHistogramRequestOptions extends RequestBasicOptions { stackByField: string; threshold?: | { - field: string | string[] | undefined; - value: number; + field: string[]; + value: string; cardinality?: { field: string[]; - value: number; + value: string; }; } | undefined; diff --git a/x-pack/plugins/security_solution/common/shared_exports.ts b/x-pack/plugins/security_solution/common/shared_exports.ts index f10aaf45dcac3..bf740ddce9fd6 100644 --- a/x-pack/plugins/security_solution/common/shared_exports.ts +++ b/x-pack/plugins/security_solution/common/shared_exports.ts @@ -17,6 +17,4 @@ export { exactCheck } from './exact_check'; export { getPaths, foldLeftRight, removeExternalLinkText } from './test_utils'; export { validate, validateEither } from './validate'; export { formatErrors } from './format_errors'; -export { migratePackagePolicyToV7110 } from './endpoint/policy/migrations/to_v7_11_0'; -export { migratePackagePolicyToV7120 } from './endpoint/policy/migrations/to_v7_12_0'; export { addIdToItem, removeIdFromItem } from './add_remove_id_to_item'; diff --git a/x-pack/plugins/security_solution/public/common/components/matrix_histogram/types.ts b/x-pack/plugins/security_solution/public/common/components/matrix_histogram/types.ts index d846d887cb681..2e0f1ac762ca8 100644 --- a/x-pack/plugins/security_solution/public/common/components/matrix_histogram/types.ts +++ b/x-pack/plugins/security_solution/public/common/components/matrix_histogram/types.ts @@ -15,6 +15,7 @@ import { MatrixHistogramType } from '../../../../common/search_strategy/security import { UpdateDateRange } from '../charts/common'; import { GlobalTimeArgs } from '../../containers/use_global_time'; import { DocValueFields } from '../../../../common/search_strategy'; +import { Threshold } from '../../../detections/components/rules/query_preview'; export type MatrixHistogramMappingTypes = Record< string, @@ -74,16 +75,7 @@ export interface MatrixHistogramQueryProps { stackByField: string; startDate: string; histogramType: MatrixHistogramType; - threshold?: - | { - field: string | string[] | undefined; - value: number; - cardinality?: { - field: string[]; - value: number; - }; - } - | undefined; + threshold?: Threshold; skip?: boolean; isPtrIncluded?: boolean; } diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/helpers.ts b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/helpers.ts index dd01a9bc4b2e6..bc4888acc90ff 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/helpers.ts +++ b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/helpers.ts @@ -166,7 +166,7 @@ export const getThresholdHistogramConfig = (): ChartSeriesConfigs => { yTickFormatter: (value: string | number): string => value.toLocaleString(), tickSize: 8, }, - yAxisTitle: i18n.QUERY_GRAPH_COUNT, + yAxisTitle: i18n.THRESHOLD_QUERY_GRAPH_COUNT, settings: { legendPosition: Position.Right, showLegend: true, diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.test.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.test.tsx index 1ca1f0710d78f..2ef114a25f32a 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.test.tsx @@ -328,11 +328,11 @@ describe('PreviewQuery', () => { query={{ query: { query: 'file where true', language: 'kuery' }, filters: [] }} index={['foo-*']} threshold={{ - field: 'agent.hostname', - value: 200, + field: ['agent.hostname'], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }} isDisabled={false} @@ -375,11 +375,11 @@ describe('PreviewQuery', () => { query={{ query: { query: 'file where true', language: 'kuery' }, filters: [] }} index={['foo-*']} threshold={{ - field: 'agent.hostname', - value: 200, + field: ['agent.hostname'], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }} isDisabled={false} @@ -409,7 +409,7 @@ describe('PreviewQuery', () => { expect(wrapper.find('[data-test-subj="previewQueryWarning"]').exists()).toBeTruthy(); }); - test('it renders query histogram when preview button clicked, rule type is threshold, and threshold field is not defined', () => { + test('it renders query histogram when preview button clicked, rule type is threshold, and threshold field is empty array', () => { const wrapper = mount( { query={{ query: { query: 'file where true', language: 'kuery' }, filters: [] }} index={['foo-*']} threshold={{ - field: undefined, - value: 200, + field: [], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }} isDisabled={false} @@ -451,11 +451,11 @@ describe('PreviewQuery', () => { query={{ query: { query: 'file where true', language: 'kuery' }, filters: [] }} index={['foo-*']} threshold={{ - field: ' ', - value: 200, + field: [' '], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }} isDisabled={false} diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.tsx index c0c26780e8d71..70d292660388d 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.tsx @@ -32,6 +32,7 @@ import { formatDate } from '../../../../common/components/super_date_picker'; import { State, queryPreviewReducer } from './reducer'; import { isNoisy } from './helpers'; import { PreviewCustomQueryHistogram } from './custom_histogram'; +import { FieldValueThreshold } from '../threshold_input'; const Select = styled(EuiSelect)` width: ${({ theme }) => theme.eui.euiSuperDatePickerWidth}; @@ -56,16 +57,7 @@ export const initialState: State = { showNonEqlHistogram: false, }; -export type Threshold = - | { - field: string | string[] | undefined; - value: number; - cardinality?: { - field: string[]; - value: number; - }; - } - | undefined; +export type Threshold = FieldValueThreshold | undefined; interface PreviewQueryProps { dataTestSubj: string; diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.test.ts b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.test.ts index b0728cd8cc827..930b7066da5cc 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.test.ts +++ b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.test.ts @@ -335,11 +335,11 @@ describe('queryPreviewReducer', () => { const update = reducer(initialState, { type: 'setThresholdQueryVals', threshold: { - field: 'agent.hostname', - value: 200, + field: ['agent.hostname'], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }, ruleType: 'threshold', @@ -351,15 +351,15 @@ describe('queryPreviewReducer', () => { expect(update.warnings).toEqual([]); }); - test('should set thresholdFieldExists to false if threshold field is not defined', () => { + test('should set thresholdFieldExists to false if threshold field is empty array', () => { const update = reducer(initialState, { type: 'setThresholdQueryVals', threshold: { - field: undefined, - value: 200, + field: [], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }, ruleType: 'threshold', @@ -375,11 +375,11 @@ describe('queryPreviewReducer', () => { const update = reducer(initialState, { type: 'setThresholdQueryVals', threshold: { - field: ' ', - value: 200, + field: [' '], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }, ruleType: 'threshold', @@ -395,11 +395,11 @@ describe('queryPreviewReducer', () => { const update = reducer(initialState, { type: 'setThresholdQueryVals', threshold: { - field: 'agent.hostname', - value: 200, + field: ['agent.hostname'], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }, ruleType: 'eql', @@ -414,11 +414,11 @@ describe('queryPreviewReducer', () => { const update = reducer(initialState, { type: 'setThresholdQueryVals', threshold: { - field: 'agent.hostname', - value: 200, + field: ['agent.hostname'], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }, ruleType: 'query', @@ -433,11 +433,11 @@ describe('queryPreviewReducer', () => { const update = reducer(initialState, { type: 'setThresholdQueryVals', threshold: { - field: 'agent.hostname', - value: 200, + field: ['agent.hostname'], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }, ruleType: 'saved_query', diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.ts b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.ts index 2d301bf96122d..2dff858d61c79 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.ts +++ b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.ts @@ -67,7 +67,6 @@ export type Action = type: 'setToFrom'; }; -/* eslint-disable-next-line complexity */ export const queryPreviewReducer = () => (state: State, action: Action): State => { switch (action.type) { case 'setQueryInfo': { @@ -132,9 +131,8 @@ export const queryPreviewReducer = () => (state: State, action: Action): State = const thresholdField = action.threshold != null && action.threshold.field != null && - ((typeof action.threshold.field === 'string' && action.threshold.field.trim() !== '') || - (Array.isArray(action.threshold.field) && - action.threshold.field.every((field) => field.trim() !== ''))); + action.threshold.field.length > 0 && + action.threshold.field.every((field) => field.trim() !== ''); const showNonEqlHist = action.ruleType === 'query' || action.ruleType === 'saved_query' || diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/translations.ts b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/translations.ts index b3cd8769a34a3..4809a39ef2937 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/translations.ts +++ b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/translations.ts @@ -42,6 +42,13 @@ export const QUERY_GRAPH_COUNT = i18n.translate( } ); +export const THRESHOLD_QUERY_GRAPH_COUNT = i18n.translate( + 'xpack.securitySolution.detectionEngine.queryPreview.queryThresholdGraphCountLabel', + { + defaultMessage: 'Cumulative Threshold Count', + } +); + export const QUERY_GRAPH_HITS_TITLE = i18n.translate( 'xpack.securitySolution.detectionEngine.queryPreview.queryGraphHitsTitle', { diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx index 733c2303255cc..362dbb4bb722b 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx @@ -6,7 +6,7 @@ */ import { EuiButtonEmpty, EuiFormRow, EuiSpacer } from '@elastic/eui'; -import React, { FC, memo, useCallback, useState, useEffect, useMemo } from 'react'; +import React, { FC, memo, useCallback, useState, useEffect } from 'react'; import styled from 'styled-components'; // Prefer importing entire lodash library, e.g. import { get } from "lodash" // eslint-disable-next-line no-restricted-imports @@ -54,7 +54,7 @@ import { import { EqlQueryBar } from '../eql_query_bar'; import { ThreatMatchInput } from '../threatmatch_input'; import { BrowserField, BrowserFields, useFetchIndex } from '../../../../common/containers/source'; -import { PreviewQuery, Threshold } from '../query_preview'; +import { PreviewQuery } from '../query_preview'; const CommonUseField = getUseField({ component: Field }); @@ -154,24 +154,15 @@ const StepDefineRuleComponent: FC = ({ ruleType: formRuleType, queryBar: formQuery, threatIndex: formThreatIndex, - 'threshold.field': formThresholdField, - 'threshold.value': formThresholdValue, - 'threshold.cardinality.field': formThresholdCardinalityField, - 'threshold.cardinality.value': formThresholdCardinalityValue, + threshold: formThreshold, }, - ] = useFormData< - DefineStepRule & { - 'threshold.field': string[] | undefined; - 'threshold.value': number | undefined; - 'threshold.cardinality.field': string[] | undefined; - 'threshold.cardinality.value': number | undefined; - } - >({ + ] = useFormData({ form, watch: [ 'index', 'ruleType', 'queryBar', + 'threshold', 'threshold.field', 'threshold.value', 'threshold.cardinality.field', @@ -288,24 +279,6 @@ const StepDefineRuleComponent: FC = ({ setOpenTimelineSearch(false); }, []); - const thresholdFormValue = useMemo((): Threshold | undefined => { - return formThresholdValue != null - ? { - field: formThresholdField ?? [], - value: formThresholdValue, - cardinality: { - field: formThresholdCardinalityField ?? [], - value: formThresholdCardinalityValue ?? 0, // FIXME - }, - } - : undefined; - }, [ - formThresholdField, - formThresholdValue, - formThresholdCardinalityField, - formThresholdCardinalityValue, - ]); - const ThresholdInputChildren = useCallback( ({ thresholdField, thresholdValue, thresholdCardinalityField, thresholdCardinalityValue }) => ( = ({ index={index} query={formQuery} isDisabled={!isQueryBarValid || index.length === 0} - threshold={thresholdFormValue} + threshold={formThreshold} /> )} diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/__mocks__/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/__mocks__/index.ts index 0bf1118835414..4b374dc0ceaa6 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/__mocks__/index.ts @@ -99,17 +99,19 @@ export const expectedThresholdDsl = { aggregations: { eventActionGroup: { terms: { - field: 'host.name', + script: { + lang: 'painless', + source: "doc['host.name'].value + ':' + doc['agent.name'].value", + }, order: { _count: 'desc' }, size: 10, - min_doc_count: 200, }, aggs: { events: { date_histogram: { field: '@timestamp', fixed_interval: '2700000ms', - min_doc_count: 0, + min_doc_count: 200, extended_bounds: { min: 1599581486215, max: 1599667886215 }, }, }, @@ -157,14 +159,130 @@ export const expectedThresholdMissingFieldDsl = { missing: 'All others', order: { _count: 'desc' }, size: 10, - min_doc_count: 200, }, aggs: { events: { date_histogram: { field: '@timestamp', fixed_interval: '2700000ms', - min_doc_count: 0, + min_doc_count: 200, + extended_bounds: { min: 1599581486215, max: 1599667886215 }, + }, + }, + }, + }, + }, + query: { + bool: { + filter: [ + { bool: { must: [], filter: [{ match_all: {} }], should: [], must_not: [] } }, + { + range: { + '@timestamp': { + gte: '2020-09-08T16:11:26.215Z', + lte: '2020-09-09T16:11:26.215Z', + format: 'strict_date_optional_time', + }, + }, + }, + ], + }, + }, + size: 0, + }, +}; + +export const expectedThresholdWithCardinalityDsl = { + allowNoIndices: true, + body: { + aggregations: { + eventActionGroup: { + aggs: { + cardinality_check: { + bucket_selector: { + buckets_path: { cardinalityCount: 'cardinality_count' }, + script: 'params.cardinalityCount >= 10', + }, + }, + cardinality_count: { cardinality: { field: 'agent.name' } }, + events: { + date_histogram: { + extended_bounds: { max: 1599667886215, min: 1599581486215 }, + field: '@timestamp', + fixed_interval: '2700000ms', + min_doc_count: 200, + }, + }, + }, + terms: { + field: 'event.action', + missing: 'All others', + order: { _count: 'desc' }, + size: 10, + }, + }, + }, + query: { + bool: { + filter: [ + { bool: { filter: [{ match_all: {} }], must: [], must_not: [], should: [] } }, + { + range: { + '@timestamp': { + format: 'strict_date_optional_time', + gte: '2020-09-08T16:11:26.215Z', + lte: '2020-09-09T16:11:26.215Z', + }, + }, + }, + ], + }, + }, + size: 0, + }, + ignoreUnavailable: true, + index: [ + 'apm-*-transaction*', + 'auditbeat-*', + 'endgame-*', + 'filebeat-*', + 'logs-*', + 'packetbeat-*', + 'winlogbeat-*', + ], + track_total_hits: true, +}; + +export const expectedThresholdWithGroupFieldsAndCardinalityDsl = { + index: [ + 'apm-*-transaction*', + 'auditbeat-*', + 'endgame-*', + 'filebeat-*', + 'logs-*', + 'packetbeat-*', + 'winlogbeat-*', + ], + allowNoIndices: true, + ignoreUnavailable: true, + track_total_hits: true, + body: { + aggregations: { + eventActionGroup: { + terms: { + script: { + lang: 'painless', + source: "doc['host.name'].value + ':' + doc['agent.name'].value", + }, + order: { _count: 'desc' }, + size: 10, + }, + aggs: { + events: { + date_histogram: { + field: '@timestamp', + fixed_interval: '2700000ms', + min_doc_count: 200, extended_bounds: { min: 1599581486215, max: 1599667886215 }, }, }, diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/helpers.test.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/helpers.test.ts new file mode 100644 index 0000000000000..ed317031dab04 --- /dev/null +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/helpers.test.ts @@ -0,0 +1,174 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { buildThresholdTermsQuery, buildThresholdCardinalityQuery, BaseQuery } from './helpers'; + +const BASE_QUERY: BaseQuery = { + eventActionGroup: { + terms: { + order: { + _count: 'desc', + }, + size: 10, + }, + aggs: { + events: { + date_histogram: { + field: '@timestamp', + fixed_interval: '5000ms', + min_doc_count: 0, + extended_bounds: { + min: 1599581486215, + max: 1599667886215, + }, + }, + }, + }, + }, +}; + +const STACK_BY_FIELD = 'event.action'; + +describe('buildEventsHistogramQuery - helpers', () => { + describe('buildThresholdTermsQuery', () => { + test('it builds a terms query using script if threshold field/s exist', () => { + const query = buildThresholdTermsQuery({ + query: BASE_QUERY, + fields: ['agent.name', 'host.name'], + stackByField: STACK_BY_FIELD, + missing: {}, + }); + expect(query).toEqual({ + eventActionGroup: { + aggs: { + events: { + date_histogram: { + extended_bounds: { max: 1599667886215, min: 1599581486215 }, + field: '@timestamp', + fixed_interval: '5000ms', + min_doc_count: 0, + }, + }, + }, + terms: { + order: { _count: 'desc' }, + script: { + lang: 'painless', + source: "doc['agent.name'].value + ':' + doc['host.name'].value", + }, + size: 10, + }, + }, + }); + }); + + test('it builds a terms query using default stackByField if threshold field/s do not exist', () => { + const query = buildThresholdTermsQuery({ + query: BASE_QUERY, + fields: [], + stackByField: STACK_BY_FIELD, + missing: { missing: 'All others' }, + }); + expect(query).toEqual({ + eventActionGroup: { + aggs: { + events: { + date_histogram: { + extended_bounds: { max: 1599667886215, min: 1599581486215 }, + field: '@timestamp', + fixed_interval: '5000ms', + min_doc_count: 0, + }, + }, + }, + terms: { + field: 'event.action', + missing: 'All others', + order: { _count: 'desc' }, + size: 10, + }, + }, + }); + }); + }); + + describe('buildThresholdCardinalityQuery', () => { + const TERMS_QUERY = { + eventActionGroup: { + terms: { + field: 'host.name', + order: { _count: 'desc' }, + size: 10, + min_doc_count: 200, + }, + aggs: { + events: { + date_histogram: { + field: '@timestamp', + fixed_interval: '2700000ms', + min_doc_count: 0, + extended_bounds: { min: 1599581486215, max: 1599667886215 }, + }, + }, + }, + }, + }; + + test('it builds query with cardinality', () => { + const query = buildThresholdCardinalityQuery({ + query: TERMS_QUERY, + cardinalityField: 'agent.name', + cardinalityValue: '100', + }); + expect(query).toEqual({ + eventActionGroup: { + aggs: { + cardinality_check: { + bucket_selector: { + buckets_path: { cardinalityCount: 'cardinality_count' }, + script: 'params.cardinalityCount >= 100', + }, + }, + cardinality_count: { cardinality: { field: 'agent.name' } }, + events: { + date_histogram: { + extended_bounds: { max: 1599667886215, min: 1599581486215 }, + field: '@timestamp', + fixed_interval: '2700000ms', + min_doc_count: 0, + }, + }, + }, + terms: { field: 'host.name', min_doc_count: 200, order: { _count: 'desc' }, size: 10 }, + }, + }); + }); + + test('it builds a terms query using default stackByField if threshold field/s do not exist', () => { + const query = buildThresholdCardinalityQuery({ + query: TERMS_QUERY, + cardinalityField: '', + cardinalityValue: '', + }); + expect(query).toEqual({ + eventActionGroup: { + aggs: { + events: { + date_histogram: { + extended_bounds: { max: 1599667886215, min: 1599581486215 }, + field: '@timestamp', + fixed_interval: '2700000ms', + min_doc_count: 0, + }, + }, + }, + terms: { field: 'host.name', min_doc_count: 200, order: { _count: 'desc' }, size: 10 }, + }, + }); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/helpers.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/helpers.ts new file mode 100644 index 0000000000000..6aed879371a0a --- /dev/null +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/helpers.ts @@ -0,0 +1,114 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export interface BaseQuery { + eventActionGroup: { + terms: { + min_doc_count?: number; + order?: { + _count?: string; + }; + size?: number; + field?: string | string[]; + script?: { + lang: string; + source: string; + }; + missing?: string; + }; + aggs: { + events?: unknown; + cardinality_count?: { + cardinality?: { + field?: string; + }; + }; + cardinality_check?: { + bucket_selector?: { + buckets_path?: { + cardinalityCount?: string; + }; + script?: string; + }; + }; + }; + }; +} + +export const buildThresholdTermsQuery = ({ + query, + fields, + stackByField, + missing, +}: { + query: BaseQuery; + fields: string[]; + stackByField: string; + missing: { missing?: string }; +}): BaseQuery => { + if (fields.length > 1) { + return { + eventActionGroup: { + ...query.eventActionGroup, + terms: { + ...query.eventActionGroup.terms, + script: { + lang: 'painless', + source: fields.map((f) => `doc['${f}'].value`).join(` + ':' + `), + }, + }, + }, + }; + } else { + return { + eventActionGroup: { + ...query.eventActionGroup, + terms: { + ...query.eventActionGroup.terms, + field: fields[0] ?? stackByField, + ...missing, + }, + }, + }; + } +}; + +export const buildThresholdCardinalityQuery = ({ + query, + cardinalityField, + cardinalityValue, +}: { + query: BaseQuery; + cardinalityField: string | undefined; + cardinalityValue: string; +}): BaseQuery => { + if (cardinalityField != null && cardinalityField !== '' && cardinalityValue !== '') { + return { + eventActionGroup: { + ...query.eventActionGroup, + aggs: { + ...query.eventActionGroup.aggs, + cardinality_count: { + cardinality: { + field: cardinalityField, + }, + }, + cardinality_check: { + bucket_selector: { + buckets_path: { + cardinalityCount: 'cardinality_count', + }, + script: `params.cardinalityCount >= ${cardinalityValue}`, + }, + }, + }, + }, + }; + } else { + return query; + } +}; diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.test.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.test.ts index c6e15aeefed1f..a2d8650b3380f 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.test.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.test.ts @@ -11,6 +11,7 @@ import { expectedDsl, expectedThresholdDsl, expectedThresholdMissingFieldDsl, + expectedThresholdWithCardinalityDsl, } from './__mocks__/'; describe('buildEventsHistogramQuery', () => { @@ -18,15 +19,111 @@ describe('buildEventsHistogramQuery', () => { expect(buildEventsHistogramQuery(mockOptions)).toEqual(expectedDsl); }); - test('builds query with just min doc if "threshold.field" is undefined and "missing" param included', () => { + test('builds query with just min doc if "threshold.field" is empty array and "missing" param included', () => { expect( - buildEventsHistogramQuery({ ...mockOptions, threshold: { field: undefined, value: 200 } }) + buildEventsHistogramQuery({ + ...mockOptions, + threshold: { field: [], value: '200', cardinality: { field: [], value: '0' } }, + }) ).toEqual(expectedThresholdMissingFieldDsl); }); - test('builds query with specified threshold field and without "missing" param if "threshold.field" is defined', () => { + test('builds query with specified threshold fields and without "missing" param if "threshold.field" is multi field', () => { expect( - buildEventsHistogramQuery({ ...mockOptions, threshold: { field: 'host.name', value: 200 } }) + buildEventsHistogramQuery({ + ...mockOptions, + threshold: { + field: ['host.name', 'agent.name'], + value: '200', + }, + }) ).toEqual(expectedThresholdDsl); }); + + test('builds query with specified threshold cardinality if defined', () => { + expect( + buildEventsHistogramQuery({ + ...mockOptions, + threshold: { + field: [], + value: '200', + cardinality: { field: ['agent.name'], value: '10' }, + }, + }) + ).toEqual(expectedThresholdWithCardinalityDsl); + }); + + test('builds query with specified threshold group fields and cardinality if defined', () => { + expect( + buildEventsHistogramQuery({ + ...mockOptions, + threshold: { + field: ['host.name', 'agent.name'], + value: '200', + cardinality: { field: ['agent.name'], value: '10' }, + }, + }) + ).toEqual({ + allowNoIndices: true, + body: { + aggregations: { + eventActionGroup: { + aggs: { + cardinality_check: { + bucket_selector: { + buckets_path: { cardinalityCount: 'cardinality_count' }, + script: 'params.cardinalityCount >= 10', + }, + }, + cardinality_count: { cardinality: { field: 'agent.name' } }, + events: { + date_histogram: { + extended_bounds: { max: 1599667886215, min: 1599581486215 }, + field: '@timestamp', + fixed_interval: '2700000ms', + min_doc_count: 200, + }, + }, + }, + terms: { + order: { _count: 'desc' }, + script: { + lang: 'painless', + source: "doc['host.name'].value + ':' + doc['agent.name'].value", + }, + size: 10, + }, + }, + }, + query: { + bool: { + filter: [ + { bool: { filter: [{ match_all: {} }], must: [], must_not: [], should: [] } }, + { + range: { + '@timestamp': { + format: 'strict_date_optional_time', + gte: '2020-09-08T16:11:26.215Z', + lte: '2020-09-09T16:11:26.215Z', + }, + }, + }, + ], + }, + }, + size: 0, + }, + ignoreUnavailable: true, + index: [ + 'apm-*-transaction*', + 'auditbeat-*', + 'endgame-*', + 'filebeat-*', + 'logs-*', + 'packetbeat-*', + 'winlogbeat-*', + ], + track_total_hits: true, + }); + }); }); diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.ts index 04b428f9de89e..15bc4694c1174 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.ts @@ -14,6 +14,7 @@ import { } from '../../../../../utils/build_query'; import { MatrixHistogramRequestOptions } from '../../../../../../common/search_strategy/security_solution/matrix_histogram'; import * as i18n from './translations'; +import { BaseQuery, buildThresholdCardinalityQuery, buildThresholdTermsQuery } from './helpers'; export const buildEventsHistogramQuery = ({ filterQuery, @@ -42,7 +43,7 @@ export const buildEventsHistogramQuery = ({ date_histogram: { field: histogramTimestampField, fixed_interval: interval, - min_doc_count: 0, + min_doc_count: threshold != null ? Number(threshold?.value) : 0, extended_bounds: { min: moment(from).valueOf(), max: moment(to).valueOf(), @@ -58,22 +59,37 @@ export const buildEventsHistogramQuery = ({ : {}; if (threshold != null) { - return { + const query: BaseQuery = { eventActionGroup: { terms: { - field: threshold.field ?? stackByField, - ...(threshold.field != null ? {} : missing), order: { _count: 'desc', }, size: 10, - min_doc_count: threshold.value, }, aggs: { events: dateHistogram, }, }, }; + const baseQuery = buildThresholdTermsQuery({ + query, + fields: threshold.field ?? [], + stackByField, + missing, + }); + + if (threshold.cardinality != null) { + const enrichedQuery = buildThresholdCardinalityQuery({ + query: baseQuery, + cardinalityField: threshold.cardinality.field[0], + cardinalityValue: threshold.cardinality.value, + }); + + return enrichedQuery; + } + + return baseQuery; } return { diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 8eec34c137ecb..9193bbe35833b 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -952,12 +952,8 @@ "data.query.queryBar.kqlOffLabel": "オフ", "data.query.queryBar.kqlOnLabel": "オン", "data.query.queryBar.luceneLanguageName": "Lucene", - "data.query.queryBar.luceneSyntaxWarningMessage": "Lucene クエリ構文を使用しているようですが、Kibana クエリ言語 (KQL) が選択されています。KQL ドキュメント {link} を確認してください。", - "data.query.queryBar.luceneSyntaxWarningOptOutText": "今後表示しない", - "data.query.queryBar.luceneSyntaxWarningTitle": "Lucene 構文警告", "data.query.queryBar.searchInputAriaLabel": "{pageType} ページの検索とフィルタリングを行うには入力を開始してください", "data.query.queryBar.searchInputPlaceholder": "検索", - "data.query.queryBar.syntaxOptionsDescription.docsLinkText": "こちら", "data.query.queryBar.syntaxOptionsTitle": "構文オプション", "data.search.aggs.aggGroups.bucketsText": "バケット", "data.search.aggs.aggGroups.metricsText": "メトリック", @@ -2389,14 +2385,14 @@ "home.tutorials.golangMetrics.longDescription": "Metricbeat モジュール「{moduleName}」は、Golang アプリから内部メトリックを取得します。[詳細] ({learnMoreLink}) 。", "home.tutorials.golangMetrics.nameTitle": "Golang メトリック", "home.tutorials.golangMetrics.shortDescription": "Golang アプリから内部メトリックを取得します。", - "home.tutorials.googlecloudLogs.artifacts.dashboards.linkLabel": "監査ログダッシュボード", - "home.tutorials.googlecloudLogs.longDescription": "これは Google Cloud ログのモジュールです。Stackdriver から Google Pub/Sub トピックシンクにエクスポートされた監査、VPC フロー、ファイアウォールログの読み取りをサポートします。[詳細] ({learnMoreLink}) 。", - "home.tutorials.googlecloudLogs.nameTitle": "Google Cloud ログ", - "home.tutorials.googlecloudLogs.shortDescription": "Google Cloud 監査、ファイアウォール、VPC フローログを収集します。", - "home.tutorials.googlecloudMetrics.artifacts.dashboards.linkLabel": "Google Cloudメトリックダッシュボード", - "home.tutorials.googlecloudMetrics.longDescription": "「googlecloud」Metricbeatモジュールは、Stackdriver Monitoring APIを使用して、Google Cloud Platformから監視メトリックを取得します。[詳細] ({learnMoreLink}) 。", - "home.tutorials.googlecloudMetrics.nameTitle": "Google Cloudメトリック", - "home.tutorials.googlecloudMetrics.shortDescription": "Stackdriver Monitoring API を使用して、Google Cloud Platform から監視メトリックを取得します。", + "home.tutorials.gcpLogs.artifacts.dashboards.linkLabel": "監査ログダッシュボード", + "home.tutorials.gcpLogs.longDescription": "これは Google Cloud ログのモジュールです。Stackdriver から Google Pub/Sub トピックシンクにエクスポートされた監査、VPC フロー、ファイアウォールログの読み取りをサポートします。[詳細]({learnMoreLink})。", + "home.tutorials.gcpLogs.nameTitle": "Google Cloud ログ", + "home.tutorials.gcpLogs.shortDescription": "Google Cloud 監査、ファイアウォール、VPC フローログを収集します。", + "home.tutorials.gcpMetrics.artifacts.dashboards.linkLabel": "Google Cloudメトリックダッシュボード", + "home.tutorials.gcpMetrics.longDescription": "「gcp」Metricbeatモジュールは、Stackdriver Monitoring APIを使用して、Google Cloud Platformから監視メトリックを取得します。[詳細]({learnMoreLink})。", + "home.tutorials.gcpMetrics.nameTitle": "Google Cloudメトリック", + "home.tutorials.gcpMetrics.shortDescription": "Stackdriver Monitoring API を使用して、Google Cloud Platform から監視メトリックを取得します。", "home.tutorials.gsuiteLogs.artifacts.dashboards.linkLabel": "セキュリティアプリ", "home.tutorials.gsuiteLogs.longDescription": "これは異なる GSuite 監査レポート API からデータを取り込むためのモジュールです。[詳細] ({learnMoreLink}) 。", "home.tutorials.gsuiteLogs.nameTitle": "GSuite ログ", @@ -17067,7 +17063,6 @@ "xpack.reporting.panelContent.notification.cantReachServerDescription": "サーバーと通信できません。再試行してください。", "xpack.reporting.panelContent.notification.reportingErrorTitle": "レポートエラー", "xpack.reporting.panelContent.saveWorkDescription": "レポートの生成前に変更内容を保存してください。", - "xpack.reporting.panelContent.successfullyQueuedReportNotificationDescription": "管理で進捗を確認できます", "xpack.reporting.panelContent.successfullyQueuedReportNotificationTitle": "{objectType} のレポートキュー", "xpack.reporting.panelContent.whatCanBeExportedWarningDescription": "初めに変更内容を保存してください", "xpack.reporting.panelContent.whatCanBeExportedWarningTitle": "保存された {objectType} のみエクスポートできます", @@ -17086,7 +17081,6 @@ "xpack.reporting.publicNotifier.maxSizeReached.partialReportTitle": "{reportObjectType}「{reportObjectTitle}」の部分レポートが作成されました", "xpack.reporting.publicNotifier.pollingErrorMessage": "レポート通知エラー", "xpack.reporting.publicNotifier.reportLink.pickItUpFromPathDescription": "{path}から開始します。", - "xpack.reporting.publicNotifier.reportLink.reportingSectionUrlLinkLabel": "管理 > Kibana > レポート", "xpack.reporting.publicNotifier.successfullyCreatedReportNotificationTitle": "{reportObjectType}「{reportObjectTitle}」のレポートが作成されました", "xpack.reporting.registerFeature.reportingDescription": "Discover、可視化、ダッシュボードから生成されたレポートを管理します。", "xpack.reporting.registerFeature.reportingTitle": "レポート", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 5ac0bd7d571fd..d7efb64129f83 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -955,12 +955,8 @@ "data.query.queryBar.kqlOffLabel": "关闭", "data.query.queryBar.kqlOnLabel": "开启", "data.query.queryBar.luceneLanguageName": "Lucene", - "data.query.queryBar.luceneSyntaxWarningMessage": "尽管选择了 Kibana 查询语言 (KQL),但似乎您正在尝试使用 Lucene 查询语法。请查看 KQL 文档 {link}。", - "data.query.queryBar.luceneSyntaxWarningOptOutText": "不再显示", - "data.query.queryBar.luceneSyntaxWarningTitle": "Lucene 语法警告", "data.query.queryBar.searchInputAriaLabel": "开始键入内容,以搜索并筛选 {pageType} 页面", "data.query.queryBar.searchInputPlaceholder": "搜索", - "data.query.queryBar.syntaxOptionsDescription.docsLinkText": "此处", "data.query.queryBar.syntaxOptionsTitle": "语法选项", "data.search.aggs.aggGroups.bucketsText": "存储桶", "data.search.aggs.aggGroups.metricsText": "指标", @@ -2401,14 +2397,14 @@ "home.tutorials.golangMetrics.longDescription": "Metricbeat 模块 `{moduleName}` 从 Golang 应用提取内部指标。[了解详情]({learnMoreLink})。", "home.tutorials.golangMetrics.nameTitle": "Golang 指标", "home.tutorials.golangMetrics.shortDescription": "从 Golang 应用提取内部指标。", - "home.tutorials.googlecloudLogs.artifacts.dashboards.linkLabel": "审计日志仪表板", - "home.tutorials.googlecloudLogs.longDescription": "此模块适用于 Google Cloud 日志。其支持读取从 Stackdriver 导出到 Google Pub/Sub 主题接收器 的审计、VPC 流和防火墙日志。[了解详情]({learnMoreLink})。", - "home.tutorials.googlecloudLogs.nameTitle": "Google Cloud 日志", - "home.tutorials.googlecloudLogs.shortDescription": "收集 Google Cloud 审计、防火墙、VPC 流日志。", - "home.tutorials.googlecloudMetrics.artifacts.dashboards.linkLabel": "Google Cloud 指标仪表板", - "home.tutorials.googlecloudMetrics.longDescription": "Metricbeat 模块 `googlecloud` 使用 Stackdriver 监测 API 从 Google Cloud Platform 提取监测指标。[了解详情]({learnMoreLink})。", - "home.tutorials.googlecloudMetrics.nameTitle": "Google Cloud 指标", - "home.tutorials.googlecloudMetrics.shortDescription": "使用 Stackdriver 监测 API 从 Google Cloud Platform 提取监测指标。", + "home.tutorials.gcpLogs.artifacts.dashboards.linkLabel": "审计日志仪表板", + "home.tutorials.gcpLogs.longDescription": "此模块适用于 Google Cloud 日志。其支持读取从 Stackdriver 导出到 Google Pub/Sub 主题接收器 的审计、VPC 流和防火墙日志。[了解详情]({learnMoreLink})。", + "home.tutorials.gcpLogs.nameTitle": "Google Cloud 日志", + "home.tutorials.gcpLogs.shortDescription": "收集 Google Cloud 审计、防火墙、VPC 流日志。", + "home.tutorials.gcpMetrics.artifacts.dashboards.linkLabel": "Google Cloud 指标仪表板", + "home.tutorials.gcpMetrics.longDescription": "Metricbeat 模块 `gcp` 使用 Stackdriver 监测 API 从 Google Cloud Platform 提取监测指标。[了解详情]({learnMoreLink})。", + "home.tutorials.gcpMetrics.nameTitle": "Google Cloud 指标", + "home.tutorials.gcpMetrics.shortDescription": "使用 Stackdriver 监测 API 从 Google Cloud Platform 提取监测指标。", "home.tutorials.gsuiteLogs.artifacts.dashboards.linkLabel": "Security 应用", "home.tutorials.gsuiteLogs.longDescription": "这是用于从不同 GSuite 审计报告 API 采集数据的模块。[了解详情]({learnMoreLink})。", "home.tutorials.gsuiteLogs.nameTitle": "GSuite 日志", @@ -17293,7 +17289,6 @@ "xpack.reporting.panelContent.notification.cantReachServerDescription": "无法访问服务器。请重试。", "xpack.reporting.panelContent.notification.reportingErrorTitle": "报告错误", "xpack.reporting.panelContent.saveWorkDescription": "请在生成报告之前保存您的工作。", - "xpack.reporting.panelContent.successfullyQueuedReportNotificationDescription": "在“管理”中跟踪其进度", "xpack.reporting.panelContent.successfullyQueuedReportNotificationTitle": "已为 {objectType} 排队报告", "xpack.reporting.panelContent.whatCanBeExportedWarningDescription": "请先保存您的工作", "xpack.reporting.panelContent.whatCanBeExportedWarningTitle": "只会导出保存的 {objectType}", @@ -17312,7 +17307,6 @@ "xpack.reporting.publicNotifier.maxSizeReached.partialReportTitle": "已为 {reportObjectType} '{reportObjectTitle}' 创建部分报告", "xpack.reporting.publicNotifier.pollingErrorMessage": "报告通知器错误!", "xpack.reporting.publicNotifier.reportLink.pickItUpFromPathDescription": "从 {path} 中提取。", - "xpack.reporting.publicNotifier.reportLink.reportingSectionUrlLinkLabel": "管理 > Kibana > Reporting", "xpack.reporting.publicNotifier.successfullyCreatedReportNotificationTitle": "已为 {reportObjectType}“{reportObjectTitle}”创建报告", "xpack.reporting.registerFeature.reportingDescription": "管理您从 Discover、Visualize 和 Dashboard 生成的报告。", "xpack.reporting.registerFeature.reportingTitle": "Reporting",