* Explicit name for doc snippets
This change adds option to specify explicit name for doc snippet.
This name will be used instead of line number when creating
yml file in buildRestTests task.
Stable names should improve tracking changes through history and allow
Gradle to skip tests on non-code docs changes.
* Avoid duplication in names
* Changes id declaration, more examples
* Fix names in examples
* Unit test added
* Throw exception on duplicate names
* Moved UT to Java
Several files in the REST APIs nav section are included using
:leveloffset: tags. This increments headings (h2 -> h3, h3 -> h4, etc.)
in those files and removes the :leveloffset: tags.
Other supporting changes:
* Alphabetizes top-level REST API nav items.
* Change 'indices APIs' heading to 'index APIs.'
* Changes 'Snapshot lifecycle management' heading to sentence case.
Converts docs for `_cat/segments`, `_cat/plugins` and `_cat/repositories`
from `curl` to `// CONSOLE` so they are tested as part of the build and
are cleaner to use in Console. They should work fine with `curl` with
the `COPY AS CURL` link.
Also swaps the `source` type of the response from `js` to `txt` because
that is more correct. The syntax highlighter doesn't care. It looks at
the text to figure out the language. So it looks a little funny for `_cat`
responses regardless.
Relates to #18160