diff --git a/src/ui/public/field_editor/components/scripting_call_outs/help_flyout.js b/src/ui/public/field_editor/components/scripting_call_outs/help_flyout.js
deleted file mode 100644
index 3d7c9b2025867..0000000000000
--- a/src/ui/public/field_editor/components/scripting_call_outs/help_flyout.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import React from 'react';
-import { getDocLink } from 'ui/documentation_links';
-
-import {
- EuiCode,
- EuiFlyout,
- EuiFlyoutBody,
- EuiIcon,
- EuiLink,
- EuiText,
-} from '@elastic/eui';
-
-export const ScriptingHelpFlyout = ({
- isVisible = false,
- onClose = () => {},
-}) => {
- return isVisible ? (
-
-
-
-
Scripting help
-
- By default, Kibana scripted fields use {(
-
- Painless
-
- )}, a simple and secure scripting language designed specifically for use with Elasticsearch,
- to access values in the document use the following format:
-
-
- doc['some_field'].value
-
-
- Painless is powerful but easy to use. It provides access to many {(
-
- native Java APIs
-
- )}. Read up on its {(
-
- syntax
-
- )} and you'll be up to speed in no time!
-
-
- Kibana currently imposes one special limitation on the painless scripts you write. They cannot contain named functions.
-
-
- Coming from an older version of Kibana? The {(
-
- Lucene Expressions
-
- )} you know and love are still available. Lucene expressions are a lot like JavaScript,
- but limited to basic arithmetic, bitwise and comparison operations.
-
-
- There are a few limitations when using Lucene Expressions:
-
-
-
Only numeric, boolean, date, and geo_point fields may be accessed
-
Stored fields are not available
-
If a field is sparse (only some documents contain a value), documents missing the field will have a value of 0
-
-
- Here are all the operations available to lucene expressions:
-
-
-
Arithmetic operators: + - * / %
-
Bitwise operators: | & ^ ~ << >> >>>
-
Boolean operators (including the ternary operator): && || ! ?:
-
Comparison operators: < <= == >= >
-
Common mathematic functions: abs ceil exp floor ln log10 logn max min sqrt pow
-
Trigonometric library functions: acosh acos asinh asin atanh atan atan2 cosh cos sinh sin tanh tan
-
Distance functions: haversin
-
Miscellaneous functions: min, max
-
-
-
-
- ) : null;
-};
-
-ScriptingHelpFlyout.displayName = 'ScriptingHelpFlyout';
diff --git a/src/ui/public/field_editor/components/scripting_call_outs/index.js b/src/ui/public/field_editor/components/scripting_call_outs/index.js
index 44da62f3e22f2..1ecf919ce6b16 100644
--- a/src/ui/public/field_editor/components/scripting_call_outs/index.js
+++ b/src/ui/public/field_editor/components/scripting_call_outs/index.js
@@ -19,4 +19,3 @@
export { ScriptingDisabledCallOut } from './disabled_call_out';
export { ScriptingWarningCallOut } from './warning_call_out';
-export { ScriptingHelpFlyout } from './help_flyout';
diff --git a/src/ui/public/field_editor/components/scripting_help/help_flyout.js b/src/ui/public/field_editor/components/scripting_help/help_flyout.js
new file mode 100644
index 0000000000000..fa92145311f21
--- /dev/null
+++ b/src/ui/public/field_editor/components/scripting_help/help_flyout.js
@@ -0,0 +1,76 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import React from 'react';
+import PropTypes from 'prop-types';
+
+import {
+ EuiFlyout,
+ EuiFlyoutBody,
+ EuiTabbedContent,
+} from '@elastic/eui';
+
+import { ScriptingSyntax } from './scripting_syntax';
+import { TestScript } from './test_script';
+
+export const ScriptingHelpFlyout = ({
+ isVisible = false,
+ onClose = () => {},
+ indexPattern,
+ lang,
+ name,
+ script,
+}) => {
+ const tabs = [{
+ id: 'syntax',
+ name: 'Syntax',
+ content: ,
+ }, {
+ id: 'test',
+ name: 'Preview results',
+ content: (
+
+ ),
+ }];
+
+ return isVisible ? (
+
+
+
+
+
+ ) : null;
+};
+
+ScriptingHelpFlyout.displayName = 'ScriptingHelpFlyout';
+
+ScriptingHelpFlyout.propTypes = {
+ indexPattern: PropTypes.object.isRequired,
+ lang: PropTypes.string.isRequired,
+ name: PropTypes.string,
+ script: PropTypes.string,
+};
diff --git a/src/ui/public/field_editor/components/scripting_call_outs/help_flyout.test.js b/src/ui/public/field_editor/components/scripting_help/help_flyout.test.js
similarity index 100%
rename from src/ui/public/field_editor/components/scripting_call_outs/help_flyout.test.js
rename to src/ui/public/field_editor/components/scripting_help/help_flyout.test.js
diff --git a/src/ui/public/field_editor/components/scripting_help/index.js b/src/ui/public/field_editor/components/scripting_help/index.js
new file mode 100644
index 0000000000000..13b3b10fb5859
--- /dev/null
+++ b/src/ui/public/field_editor/components/scripting_help/index.js
@@ -0,0 +1,20 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { ScriptingHelpFlyout } from './help_flyout';
diff --git a/src/ui/public/field_editor/components/scripting_help/scripting_syntax.js b/src/ui/public/field_editor/components/scripting_help/scripting_syntax.js
new file mode 100644
index 0000000000000..892bf5376ea1b
--- /dev/null
+++ b/src/ui/public/field_editor/components/scripting_help/scripting_syntax.js
@@ -0,0 +1,104 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import React, { Fragment } from 'react';
+import { getDocLink } from 'ui/documentation_links';
+
+import {
+ EuiCode,
+ EuiIcon,
+ EuiLink,
+ EuiText,
+ EuiSpacer,
+} from '@elastic/eui';
+
+export const ScriptingSyntax = () => (
+
+
+
+
Syntax
+
+ By default, Kibana scripted fields use {(
+
+ Painless
+
+ )}, a simple and secure scripting language designed specifically for use with Elasticsearch,
+ to access values in the document use the following format:
+
+
+ doc['some_field'].value
+
+
+ Painless is powerful but easy to use. It provides access to many {(
+
+ native Java APIs
+
+ )}. Read up on its {(
+
+ syntax
+
+ )} and you'll be up to speed in no time!
+
+
+ Kibana currently imposes one special limitation on the painless scripts you write. They cannot contain named functions.
+
+
+ Coming from an older version of Kibana? The {(
+
+ Lucene Expressions
+
+ )} you know and love are still available. Lucene expressions are a lot like JavaScript,
+ but limited to basic arithmetic, bitwise and comparison operations.
+
+
+ There are a few limitations when using Lucene Expressions:
+
+
+
Only numeric, boolean, date, and geo_point fields may be accessed
+
Stored fields are not available
+
If a field is sparse (only some documents contain a value), documents missing the field will have a value of 0
+
+
+ Here are all the operations available to lucene expressions:
+
+
+
Arithmetic operators: + - * / %
+
Bitwise operators: | & ^ ~ << >> >>>
+
Boolean operators (including the ternary operator): && || ! ?:
+
Comparison operators: < <= == >= >
+
Common mathematic functions: abs ceil exp floor ln log10 logn max min sqrt pow
+
Trigonometric library functions: acosh acos asinh asin atanh atan atan2 cosh cos sinh sin tanh tan