@@ -3,10 +3,23 @@ The static content exists in this directory and can be edited by hand.
33However, the sub-directories ` _snippets ` , ` images ` and ` kibana ` contain mostly
44generated content.
55
6+ ## Static content
7+
8+ The root ` esql ` directory and the following two subdirectories contain static content:
9+ * ` commands ` - contains the static content for the ES|QL commands.
10+ This content will typically contain mostly include directives for content in the ` _snippets ` or ` images ` directories.
11+ * ` functions-operators ` - contains the static content for the ES|QL functions and operators.
12+ Again this will contain mostly include directives for content in the ` _snippets ` or ` images ` directories.
13+
14+ ## Mixed static and generated content
15+
16+ Generated content is created by running the ESQL tests in the ` x-pack/plugin/esql ` module.
17+ It will be written into three subdirectories of the ` esql ` directory:
18+
619### _ snippets
720
8- In ` _snippets ` there are files that can be included within other files
9- using the [ File Inclusion] ( https://elastic.github.io/docs-builder/syntax/file_inclusion/ )
21+ In ` _snippets ` there are files that can be included within other files using the
22+ [ File Inclusion] ( https://elastic.github.io/docs-builder/syntax/file_inclusion/ )
1023feature of the Elastic Docs V3 system.
1124Most, but not all, files in this directory are generated.
1225In particular the directories ` _snippets/functions/* ` and ` _snippets/operators/* `
@@ -34,6 +47,19 @@ To regenerate the files for all functions run all of ESQL's tests using gradle:
3447./gradlew :x-pack:plugin:esql:test
3548```
3649
50+ #### Commands
51+
52+ The ` _snippets/commands ` directory contains the content for the ES|QL commands.
53+ There are two subdirectories, one static and one generated:
54+ * ` layout ` - contains the static content for the ES|QL commands.
55+ The files in this directory are the main content for the documentation for the commands.
56+ They are not generated, and so this is the primary place to edit the content, or add new commands.
57+ * ` examples ` - contains the generated content for the ES|QL commands.
58+ The files in this directory are generated from the test ` CommandsDocsTests ` in the ` x-pack/plugin/esql ` module.
59+ The structure of the subdirectories mimics the csv-spec files and test tags used in the tests.
60+
61+ Including generated examples in the command documentation is done by using the include directive.
62+
3763### images
3864
3965The ` images ` directory contains ` functions ` and ` operators ` sub-directories with
@@ -48,3 +74,14 @@ The `kibana` directory contains `definition` and `docs` sub-directories that are
4874* ` kibana/docs ` - the inline docs for kibana
4975
5076These are also generated as part of the unit tests described above.
77+
78+ ## Tutorials
79+
80+ ### Adding a new command
81+
82+ When adding a new command, for example adding the ` CHANGE_POINT ` comamand, do the following:
83+ 1 . Create a new file in the ` _snippets/commands/layout ` directory with the name of the command, for example ` change_point.md ` .
84+ 2 . Add the content for the command to the file. See other files in this directory for examples.
85+ 3 . Add the command to the list in ` _snippets/lists/processing-commands-md ` .
86+ 4 . Add an include directive to the ` commands/processing-commands.md ` file to include the new command.
87+ 5 . Add tested examples to the ` _snippets/commands/examples ` directory. See below for details.
0 commit comments