diff --git a/docs/reference/query-languages/esql/_snippets/operators/types/not_like.md b/docs/reference/query-languages/esql/_snippets/operators/types/not_like.md deleted file mode 100644 index 2694da68af814..0000000000000 --- a/docs/reference/query-languages/esql/_snippets/operators/types/not_like.md +++ /dev/null @@ -1,9 +0,0 @@ -% This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it. - -**Supported types** - -| str | pattern | result | -| --- | --- | --- | -| keyword | keyword | boolean | -| text | keyword | boolean | - diff --git a/docs/reference/query-languages/esql/_snippets/operators/types/not_rlike.md b/docs/reference/query-languages/esql/_snippets/operators/types/not_rlike.md deleted file mode 100644 index 2694da68af814..0000000000000 --- a/docs/reference/query-languages/esql/_snippets/operators/types/not_rlike.md +++ /dev/null @@ -1,9 +0,0 @@ -% This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it. - -**Supported types** - -| str | pattern | result | -| --- | --- | --- | -| keyword | keyword | boolean | -| text | keyword | boolean | - diff --git a/x-pack/plugin/esql/build.gradle b/x-pack/plugin/esql/build.gradle index 16b7e33a09026..fcbd72e9bacbd 100644 --- a/x-pack/plugin/esql/build.gradle +++ b/x-pack/plugin/esql/build.gradle @@ -99,11 +99,18 @@ tasks.named("test").configure { def imagesDocFolder = file("${rootDir}/docs/reference/query-languages/esql/images") def snippetsDocFolder = file("${rootDir}/docs/reference/query-languages/esql/_snippets") def kibanaDocFolder = file("${rootDir}/docs/reference/query-languages/esql/kibana") + def snippetsTree = fileTree(snippetsFolder).matching { + include "**/types/*.md" // Recursively include all types/*.md files (effectively counting functions and operators) + } + def imagesTree = fileTree(imagesFolder).matching { + include "**/*.svg" // Recursively include all SVG files + } + def kibanaTree = fileTree(kibanaFolder).matching { + include "**/*.json" // Recursively include all JSON files + } doLast { - List snippets = fileTree(snippetsFolder).matching { - include "**/types/*.md" // Recursively include all types/*.md files (effectively counting functions and operators) - }.files.collect { it.name } + def snippets = snippetsTree.files.collect { it.name } int countSnippets = snippets.size() if (countSnippets == 0) { logger.quiet("ESQL Docs: No function/operator snippets created. Skipping sync.") @@ -113,19 +120,27 @@ tasks.named("test").configure { from snippetsFolder into snippetsDocFolder include '**/*.md' - preserve { - // The snippets directory contains generated and static content, so we must preserve all MD files. - include '**/*.md' + if (countSnippets <= 100) { + // If we do not run the full test of tests, do not attempt to remove potentially unused files + preserve { + // The snippets directory contains generated and static content, so we must preserve all MD files. + include '**/*.md' + } + } else { + // If we do run the full test of tests, be careful about what we need to preserve + preserve { + // The lists are static, and the operators are a mix of generated and static content + include '*.md', '**/operators/*.md', '**/operators/**/*.md', '**/lists/*.md' + } } } } - List images = fileTree(imagesFolder).matching { - include "**/*.svg" // Recursively include all SVG files - }.files.collect { it.name } + List images = imagesTree.files.collect { it.name } int countImages = images.size() Closure replaceFont = line -> { // The es-docs team has a recommended set of fonts for use with code, and they size similarly to the previous Roboto Mono, which is no longer available in the docs webpage + // We do not change the original SVG generator to use these because it requires the fonts to exist in the JVM running the code line.replaceAll( /font-family:\s*Roboto Mono[^;]*;/, 'font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;' @@ -139,17 +154,18 @@ tasks.named("test").configure { from imagesFolder into imagesDocFolder include '**/*.svg' - preserve { - // Some operator files are currently static, so we must preserve them all - include '**/*.svg' + if (countImages <= 100) { + // If we do not run the full test of tests, do not attempt to remove potentially unused files + preserve { + // Some operator files are currently static, so we must preserve them all + include '**/*.svg' + } } filter replaceFont } } - List kibana = fileTree(kibanaFolder).matching { - include "**/*.json" // Recursively include all JSON files - }.files.collect { it.name } + List kibana = kibanaTree.files.collect { it.name } int countKibana = kibana.size() if (countKibana == 0) { logger.quiet("ESQL Docs: No function/operator kibana docs created. Skipping sync.") diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/DocsV3Support.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/DocsV3Support.java index 7d4bf54b09b68..904b7f9aef6de 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/DocsV3Support.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/DocsV3Support.java @@ -310,7 +310,7 @@ private String getLink(String key) { // Various other remaining old asciidoc links // <> return switch (parts[0]) { - case "match-field-params" -> makeLink(key, "", "/reference/query-languages/query-dsl-match-query.md"); + case "match-field-params" -> makeLink(key, "", "/reference/query-languages/query-dsl/query-dsl-match-query.md"); case "search-aggregations-bucket-histogram-aggregation" -> makeLink( key, "",