Skip to content

Commit

Permalink
[DOCS] Remove unneeded options from [source,sql] code blocks (#42759)
Browse files Browse the repository at this point in the history
In AsciiDoc, `subs="attributes,callouts,macros"` options were required
to render `include-tagged::` in a code block.

With elastic/docs#827, Elasticsearch Reference documentation migrated
from AsciiDoc to Asciidoctor.

In Asciidoctor, the `subs="attributes,callouts,macros"` options are no
longer needed to render `include-tagged::` in a code block. This commit
removes those unneeded options.

Resolves #41589
  • Loading branch information
jrodewig committed May 31, 2019
1 parent 924eb1a commit 7b39ab2
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion docs/reference/sql/language/syntax/describe-table.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ DESC table

`DESC` and `DESCRIBE` are aliases to <<sql-syntax-show-columns>>.

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[describeTable]
----
50 changes: 25 additions & 25 deletions docs/reference/sql/language/syntax/select.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The general execution of `SELECT` is as follows:

As with a table, every output column of a `SELECT` has a name which can be either specified per column through the `AS` keyword :

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[selectColumnAlias]
----
Expand All @@ -46,14 +46,14 @@ which is why it is recommended to specify it.

assigned by {es-sql} if no name is given:

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[selectInline]
----

or if it's a simple column reference, use its name as the column name:

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[selectColumn]
----
Expand All @@ -63,7 +63,7 @@ include-tagged::{sql-specs}/docs.csv-spec[selectColumn]

To select all the columns in the source, one can use `*`:

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[wildcardWithOrder]
----
Expand All @@ -90,22 +90,22 @@ Represents the name (optionally qualified) of an existing table, either a concre

If the table name contains special SQL characters (such as `.`,`-`,etc...) use double quotes to escape them:

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[fromTableQuoted]
----

The name can be a <<multi-index, pattern>> pointing to multiple indices (likely requiring quoting as mentioned above) with the restriction that *all* resolved concrete tables have **exact mapping**.

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[fromTablePatternQuoted]
----

`alias`::
A substitute name for the `FROM` item containing the alias. An alias is used for brevity or to eliminate ambiguity. When an alias is provided, it completely hides the actual name of the table and must be used in its place.

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[fromTableAlias]
----
Expand All @@ -127,7 +127,7 @@ where:

Represents an expression that evaluates to a `boolean`. Only the rows that match the condition (to `true`) are returned.

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[basicWhere]
----
Expand All @@ -151,28 +151,28 @@ Represents an expression on which rows are being grouped _on_. It can be a colum

A common, group by column name:

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[groupByColumn]
----

Grouping by output ordinal:

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[groupByOrdinal]
----

Grouping by alias:

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[groupByAlias]
----

And grouping by column expression (typically used along-side an alias):

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[groupByExpression]
----
Expand All @@ -181,21 +181,21 @@ When a `GROUP BY` clause is used in a `SELECT`, _all_ output expressions must be

To wit:

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[groupByAndAgg]
----

Expressions over aggregates used in output:

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[groupByAndAggExpression]
----

Multiple aggregates used:

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[groupByAndMultipleAggs]
----
Expand All @@ -209,14 +209,14 @@ As such, the query emits only a single row (as there is only a single group).

A common example is counting the number of records:

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[groupByImplicitCount]
----

Of course, multiple aggregations can be applied:

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[groupByImplicitMultipleAggs]
----
Expand All @@ -243,14 +243,14 @@ Both `WHERE` and `HAVING` are used for filtering however there are several signi
. `WHERE` works on individual *rows*, `HAVING` works on the *groups* created by ``GROUP BY``
. `WHERE` is evaluated *before* grouping, `HAVING` is evaluated *after* grouping

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[groupByHaving]
----

Further more, one can use multiple aggregate expressions inside `HAVING` even ones that are not used in the output (`SELECT`):

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[groupByHavingMultiple]
----
Expand All @@ -264,14 +264,14 @@ As such, the query emits only a single row (as there is only a single group) and

In this example, `HAVING` matches:

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[groupByHavingImplicitMatch]
----

//However `HAVING` can also not match, in which case an empty result is returned:
//
//["source","sql",subs="attributes,callouts,macros"]
//[source, sql]
//----
//include-tagged::{sql-specs}/docs.csv-spec[groupByHavingImplicitNoMatch]
//----
Expand Down Expand Up @@ -300,7 +300,7 @@ IMPORTANT: When used along-side, `GROUP BY` expression can point _only_ to the c
For example, the following query sorts by an arbitrary input field (`page_count`):
["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[orderByBasic]
----
Expand All @@ -317,15 +317,15 @@ combined using the same rules as {es}'s
To sort based on the `score`, use the special function `SCORE()`:
["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[orderByScore]
----
Note that you can return `SCORE()` by using a full-text search predicate in the `WHERE` clause.
This is possible even if `SCORE()` is not used for sorting:
["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[orderByScoreWithMatch]
----
Expand Down Expand Up @@ -353,7 +353,7 @@ ALL:: indicates there is no limit and thus all results are being returned.
To return
["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[limitBasic]
----
2 changes: 1 addition & 1 deletion docs/reference/sql/language/syntax/show-columns.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SHOW COLUMNS [ FROM | IN ] ? table

List the columns in table and their data type (and other attributes).

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[showColumns]
----
10 changes: 5 additions & 5 deletions docs/reference/sql/language/syntax/show-functions.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,33 @@ SHOW FUNCTIONS [ LIKE? pattern? ]? <1>

List all the SQL functions and their type. The `LIKE` clause can be used to restrict the list of names to the given pattern.

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[showFunctions]
----

The list of functions returned can be customized based on the pattern.

It can be an exact match:
["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[showFunctionsLikeExact]
----

A wildcard for exactly one character:
["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[showFunctionsLikeChar]
----

A wildcard matching zero or more characters:
["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[showFunctionsLikeWildcard]
----

Or of course, a variation of the above:
["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[showFunctionsWithPattern]
----
10 changes: 5 additions & 5 deletions docs/reference/sql/language/syntax/show-tables.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,34 @@ SHOW TABLES [ LIKE? pattern? ]? <1>

List the tables available to the current user and their type.

["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[showTables]
----

The `LIKE` clause can be used to restrict the list of names to the given pattern.

The pattern can be an exact match:
["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[showTablesLikeExact]
----

Multiple chars:
["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[showTablesLikeWildcard]
----

A single char:
["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[showTablesLikeOneChar]
----


Or a mixture of single and multiple chars:
["source","sql",subs="attributes,callouts,macros"]
[source, sql]
----
include-tagged::{sql-specs}/docs.csv-spec[showTablesLikeMixed]
----
2 changes: 1 addition & 1 deletion docs/reference/sql/security.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ the API require `cluster:monitor/main`.
The following example configures a role that can run SQL in JDBC querying the `test` and `bort`
indices:

["source","yaml",subs="attributes,callouts,macros"]
[source, yaml]
--------------------------------------------------
include-tagged::{sql-tests}/security/roles.yml[cli_jdbc]
--------------------------------------------------
Expand Down

0 comments on commit 7b39ab2

Please sign in to comment.