Explorar o código

Docs: compress results into query (ESQL-1259)

This compresses the results and the query on the page to take up less
space and make them more obviously connected.
Nik Everett %!s(int64=2) %!d(string=hai) anos
pai
achega
1f383f3cd2
Modificáronse 24 ficheiros con 68 adicións e 166 borrados
  1. 1 1
      build-tools-internal/src/main/groovy/org/elasticsearch/gradle/internal/doc/SnippetsTask.groovy
  2. 6 15
      docs/reference/esql/functions/auto_bucket.asciidoc
  3. 2 5
      docs/reference/esql/functions/mv_avg.asciidoc
  4. 5 10
      docs/reference/esql/functions/mv_concat.asciidoc
  5. 2 5
      docs/reference/esql/functions/mv_count.asciidoc
  6. 4 10
      docs/reference/esql/functions/mv_max.asciidoc
  7. 4 10
      docs/reference/esql/functions/mv_median.asciidoc
  8. 4 10
      docs/reference/esql/functions/mv_min.asciidoc
  9. 2 5
      docs/reference/esql/functions/mv_sum.asciidoc
  10. 2 5
      docs/reference/esql/functions/to_boolean.asciidoc
  11. 4 10
      docs/reference/esql/functions/to_datetime.asciidoc
  12. 2 5
      docs/reference/esql/functions/to_double.asciidoc
  13. 2 5
      docs/reference/esql/functions/to_integer.asciidoc
  14. 2 5
      docs/reference/esql/functions/to_ip.asciidoc
  15. 2 5
      docs/reference/esql/functions/to_long.asciidoc
  16. 4 10
      docs/reference/esql/functions/to_string.asciidoc
  17. 2 5
      docs/reference/esql/functions/to_version.asciidoc
  18. 2 5
      docs/reference/esql/processing-commands/dissect.asciidoc
  19. 4 10
      docs/reference/esql/processing-commands/eval.asciidoc
  20. 2 5
      docs/reference/esql/processing-commands/grok.asciidoc
  21. 2 5
      docs/reference/esql/processing-commands/mv_expand.asciidoc
  22. 2 5
      docs/reference/esql/processing-commands/project.asciidoc
  23. 4 10
      docs/reference/esql/processing-commands/stats.asciidoc
  24. 2 5
      docs/reference/esql/source-commands/row.asciidoc

+ 1 - 1
build-tools-internal/src/main/groovy/org/elasticsearch/gradle/internal/doc/SnippetsTask.groovy

@@ -304,7 +304,7 @@ class SnippetsTask extends DefaultTask {
     }
 
     static Source matchSource(String line) {
-        def matcher = line =~ /\["?source"?,\s*"?([-\w]+)"?(,((?!id=).)*(id="?([-\w]+)"?)?(.*))?].*/
+        def matcher = line =~ /\["?source"?(?:\.[^,]+)?,\s*"?([-\w]+)"?(,((?!id=).)*(id="?([-\w]+)"?)?(.*))?].*/
         if(matcher.matches()){
             return new Source(matches: true, language: matcher.group(1),  name: matcher.group(5))
         }

+ 6 - 15
docs/reference/esql/functions/auto_bucket.asciidoc

@@ -9,14 +9,11 @@ picks an appropriate bucket size to generate the target number of buckets or
 fewer. For example, this asks for at most 20 buckets over a whole year, which
 picks monthly buckets:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/date.csv-spec[tag=auto_bucket_month]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/date.csv-spec[tag=auto_bucket_month-result]
 |===
@@ -28,14 +25,11 @@ buckets.
 If you ask for more buckets then `AUTO_BUCKET` can pick a smaller range. For example,
 asking for at most 100 buckets in a year will get you week long buckets:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/date.csv-spec[tag=auto_bucket_week]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/date.csv-spec[tag=auto_bucket_week-result]
 |===
@@ -47,14 +41,11 @@ with <<esql-where>> to filter rows.
 
 A more complete example might look like:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/date.csv-spec[tag=auto_bucket_in_agg]
 ----
-
-Which returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/date.csv-spec[tag=auto_bucket_in_agg-result]
 |===

+ 2 - 5
docs/reference/esql/functions/mv_avg.asciidoc

@@ -3,14 +3,11 @@
 Converts a multivalued field into a single valued field containing the average
 of all of the values. For example:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/math.csv-spec[tag=mv_avg]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/math.csv-spec[tag=mv_avg-result]
 |===

+ 5 - 10
docs/reference/esql/functions/mv_concat.asciidoc

@@ -3,27 +3,22 @@
 Converts a multivalued string field into a single valued field containing the
 concatenation of all values separated by a delimiter:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/string.csv-spec[tag=mv_concat]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/string.csv-spec[tag=mv_concat-result]
 |===
 
 If you want to concat non-string fields call <<esql-to_string>> on them first:
-[source,esql]
+
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/string.csv-spec[tag=mv_concat-to_string]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/string.csv-spec[tag=mv_concat-to_string-result]
 |===

+ 2 - 5
docs/reference/esql/functions/mv_count.asciidoc

@@ -3,14 +3,11 @@
 Converts a multivalued field into a single valued field containing a count of the number
 of values:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/string.csv-spec[tag=mv_count]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/string.csv-spec[tag=mv_count-result]
 |===

+ 4 - 10
docs/reference/esql/functions/mv_max.asciidoc

@@ -2,14 +2,11 @@
 === `MV_MAX`
 Converts a multivalued field into a single valued field containing the maximum value. For example:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/math.csv-spec[tag=mv_max]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/math.csv-spec[tag=mv_max-result]
 |===
@@ -17,14 +14,11 @@ include::{esql-specs}/math.csv-spec[tag=mv_max-result]
 It can be used by any field type, including `keyword` fields. In that case picks the
 last string, comparing their utf-8 representation byte by byte:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/string.csv-spec[tag=mv_max]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/string.csv-spec[tag=mv_max-result]
 |===

+ 4 - 10
docs/reference/esql/functions/mv_median.asciidoc

@@ -2,14 +2,11 @@
 === `MV_MEDIAN`
 Converts a multivalued field into a single valued field containing the median value. For example:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/math.csv-spec[tag=mv_median]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/math.csv-spec[tag=mv_median-result]
 |===
@@ -18,14 +15,11 @@ It can be used by any numeric field type and returns a value of the same type. I
 row has an even number of values for a column the result will be the average of the
 middle two entries. If the field is not floating point then the average rounds *down*:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/math.csv-spec[tag=mv_median_round_down]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/math.csv-spec[tag=mv_median_round_down-result]
 |===

+ 4 - 10
docs/reference/esql/functions/mv_min.asciidoc

@@ -2,14 +2,11 @@
 === `MV_MIN`
 Converts a multivalued field into a single valued field containing the minimum value. For example:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/math.csv-spec[tag=mv_min]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/math.csv-spec[tag=mv_min-result]
 |===
@@ -17,14 +14,11 @@ include::{esql-specs}/math.csv-spec[tag=mv_min-result]
 It can be used by any field type, including `keyword` fields. In that case picks the
 first string, comparing their utf-8 representation byte by byte:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/string.csv-spec[tag=mv_min]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/string.csv-spec[tag=mv_min-result]
 |===

+ 2 - 5
docs/reference/esql/functions/mv_sum.asciidoc

@@ -3,14 +3,11 @@
 Converts a multivalued field into a single valued field containing the sum
 of all of the values. For example:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/math.csv-spec[tag=mv_sum]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/math.csv-spec[tag=mv_sum-result]
 |===

+ 2 - 5
docs/reference/esql/functions/to_boolean.asciidoc

@@ -9,14 +9,11 @@ A string value of *"true"* will be case-insensitive converted to the Boolean
 *true*. For anything else, including the empty string, the function will
 return *false*. For example:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/boolean.csv-spec[tag=to_boolean]
 ----
-
-returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/boolean.csv-spec[tag=to_boolean-result]
 |===

+ 4 - 10
docs/reference/esql/functions/to_datetime.asciidoc

@@ -8,14 +8,11 @@ type must be of a string or numeric type.
 A string will only be successfully converted if it's respecting the format
 `yyyy-MM-dd'T'HH:mm:ss.SSS'Z'`. For example:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/date.csv-spec[tag=to_datetime-str]
 ----
-
-returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/date.csv-spec[tag=to_datetime-str-result]
 |===
@@ -37,14 +34,11 @@ If the input parameter is of a numeric type, its value will be interpreted as
 milliseconds since the https://en.wikipedia.org/wiki/Unix_time[Unix epoch].
 For example:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/date.csv-spec[tag=to_datetime-int]
 ----
-
-returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/date.csv-spec[tag=to_datetime-int-result]
 |===

+ 2 - 5
docs/reference/esql/functions/to_double.asciidoc

@@ -7,14 +7,11 @@ type must be of a boolean, date, string or numeric type.
 
 Example:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/floats.csv-spec[tag=to_double-str]
 ----
-
-returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/floats.csv-spec[tag=to_double-str-result]
 |===

+ 2 - 5
docs/reference/esql/functions/to_integer.asciidoc

@@ -7,14 +7,11 @@ type must be of a boolean, date, string or numeric type.
 
 Example:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/ints.csv-spec[tag=to_int-long]
 ----
-
-returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/ints.csv-spec[tag=to_int-long-result]
 |===

+ 2 - 5
docs/reference/esql/functions/to_ip.asciidoc

@@ -6,14 +6,11 @@ The input can be a single- or multi-valued field or an expression.
 
 Example:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/ip.csv-spec[tag=to_ip]
 ----
-
-which returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/ip.csv-spec[tag=to_ip-result]
 |===

+ 2 - 5
docs/reference/esql/functions/to_long.asciidoc

@@ -7,14 +7,11 @@ type must be of a boolean, date, string or numeric type.
 
 Example:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/ints.csv-spec[tag=to_long-str]
 ----
-
-returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/ints.csv-spec[tag=to_long-str-result]
 |===

+ 4 - 10
docs/reference/esql/functions/to_string.asciidoc

@@ -2,28 +2,22 @@
 === `TO_STRING`
 Converts a field into a string. For example:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/string.csv-spec[tag=to_string]
 ----
-
-which returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/string.csv-spec[tag=to_string-result]
 |===
 
 It also works fine on multivalued fields:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/string.csv-spec[tag=to_string_multivalue]
 ----
-
-which returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/string.csv-spec[tag=to_string_multivalue-result]
 |===

+ 2 - 5
docs/reference/esql/functions/to_version.asciidoc

@@ -2,14 +2,11 @@
 === `TO_VERSION`
 Converts an input string to a version value. For example:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/version.csv-spec[tag=to_version]
 ----
-
-which returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/version.csv-spec[tag=to_version-result]
 |===

+ 2 - 5
docs/reference/esql/processing-commands/dissect.asciidoc

@@ -8,14 +8,11 @@ keys as columns.
 Refer to the <<dissect-processor,dissect processor documentation>> for the
 syntax of dissect patterns.
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/dissect.csv-spec[tag=dissect]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/dissect.csv-spec[tag=dissect-result]
 |===

+ 4 - 10
docs/reference/esql/processing-commands/eval.asciidoc

@@ -2,14 +2,11 @@
 === `EVAL`
 `EVAL` enables you to append new columns:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/docs.csv-spec[tag=eval]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/docs.csv-spec[tag=eval-result]
 |===
@@ -17,14 +14,11 @@ include::{esql-specs}/docs.csv-spec[tag=eval-result]
 If the specified column already exists, the existing column will be dropped, and
 the new column will be appended to the table:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/docs.csv-spec[tag=evalReplace]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/docs.csv-spec[tag=evalReplace-result]
 |===

+ 2 - 5
docs/reference/esql/processing-commands/grok.asciidoc

@@ -10,14 +10,11 @@ of grok patterns.
 
 For example:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/grok.csv-spec[tag=grok]
 ----
-
-Returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/grok.csv-spec[tag=grok-result]
 |===

+ 2 - 5
docs/reference/esql/processing-commands/mv_expand.asciidoc

@@ -3,14 +3,11 @@
 
 The `MV_EXPAND` processing command expands multivalued fields into one row per value, duplicating other fields:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/mv_expand.csv-spec[tag=simple]
 ----
-
-Which returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/mv_expand.csv-spec[tag=simple-result]
 |===

+ 2 - 5
docs/reference/esql/processing-commands/project.asciidoc

@@ -7,14 +7,11 @@ order in which they are returned.
 To limit the columns that are returned, use a comma-separated list of column
 names. The columns are returned in the specified order:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/docs.csv-spec[tag=project]
 ----
-
-Which returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/docs.csv-spec[tag=project-result]
 |===

+ 4 - 10
docs/reference/esql/processing-commands/stats.asciidoc

@@ -3,14 +3,11 @@
 Use `STATS ... BY` to group rows according to a common value and calculate one
 or more aggregated values over the grouped rows.
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/docs.csv-spec[tag=stats]
 ----
-
-Which returns:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/docs.csv-spec[tag=stats-result]
 |===
@@ -18,14 +15,11 @@ include::{esql-specs}/docs.csv-spec[tag=stats-result]
 If `BY` is omitted, the output table contains exactly one row with the
 aggregations applied over the entire dataset:
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/docs.csv-spec[tag=statsWithoutBy]
 ----
-
-Returning:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/docs.csv-spec[tag=statsWithoutBy-result]
 |===

+ 2 - 5
docs/reference/esql/source-commands/row.asciidoc

@@ -4,14 +4,11 @@
 The `ROW` source command produces a row with one or more columns with values
 that you specify. This can be useful for testing.
 
-[source,esql]
+[source.merge.styled,esql]
 ----
 include::{esql-specs}/row.csv-spec[tag=example]
 ----
-
-Which looks like:
-
-[%header,format=dsv,separator=|]
+[%header.monospaced.styled,format=dsv,separator=|]
 |===
 include::{esql-specs}/row.csv-spec[tag=example-result]
 |===