Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add overlay for deep objects in ML analysis_config, datafeed_config, and transform source #2904

Merged
merged 14 commits into from
Sep 19, 2024

Conversation

lcawl
Copy link
Contributor

@lcawl lcawl commented Sep 17, 2024

This PR adds overlays that address the following errors that appear when deploying documents in Bump.sh:

“09:13:35 PM Rendering of the API documentation will be limited to a max depth of 11.”
...
09:13:35 PM Ml > Create an anomaly detection job > Request Body (application/json); datafeed_config.query.span_containing...; has 28 hidden branches, e.g.; datafeed_config.query.span_containing.span_field_masking
...
09:13:35 PM Ml > Create an anomaly detection job > Request Body (application/json); analysis_config.categorization_analyzer.{_types:CategorizationAnalyzerDefinition}...; has 80 hidden branches, e.g.; analysis_config.categorization_analyzer.{_types:CategorizationAnalyzerDefinition}.tokenizer
...
09:13:35 PM Ml > Create a data frame analytics job > Request Body (application/json); source.query.span_containing...; has 28 hidden branches, e.g.; source.query.span_containing.span_field_masking
...
09:13:35 PM Transform > Get transforms > Response (200); transforms[].source.query...; has 172 hidden branches, e.g.; transforms[].source.query.bool

For now I've overlaid:

  • the entire query object within the ml._types:Datafeed, ml._types:DataframeAnalyticsSource, and transform._types:Source schema objects
  • the entire tokenizer object within ml._types:CategorizationAnalyzerDefinition

I've replaced them with descriptions that match what we had in https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html , https://www.elastic.co/guide/en/elasticsearch/reference/current/put-dfanalytics.html, and https://www.elastic.co/guide/en/elasticsearch/reference/current/put-transform.html. However, we could potentially overlay only the a subset of objects deeper within _types.query_dsl:QueryContainer and _types.analysis:Tokenizer, depending on further analysis of where they're re-used.

I've also added an x-abbreviated: true property so that we can have an indicator of where the abbreviation occurs.

Before

...
      "ml._types:Datafeed": {
        "type": "object",
        "properties": {
          "query": {
            "$ref": "#/components/schemas/_types.query_dsl:QueryContainer"
          },
...
      "ml._types:DataframeAnalyticsSource": {
        "type": "object",
        "properties": {
          "query": {
            "$ref": "#/components/schemas/_types.query_dsl:QueryContainer"
          },
...
      "transform._types:Source": {
        "type": "object",
        "properties": {
          "query": {
            "$ref": "#/components/schemas/_types.query_dsl:QueryContainer"
          },
...
      "ml._types:CategorizationAnalyzerDefinition": {
        "type": "object",
        "properties": {
          "tokenizer": {
            "$ref": "#/components/schemas/_types.analysis:Tokenizer"
          }

After

      "ml._types:Datafeed": {
        "type": "object",
        "properties": {
          "query": {
            "x-abbreviated": true,
            "type": "object",
            "description": "The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. By default, this property has the following value: `{\"match_all\": {\"boost\": 1}}`.\n",
            "externalDocs": {
              "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html",
              "description": "Query DSL"
            }
          }
...
      "ml._types:DataframeAnalyticsSource": {
        "type": "object",
        "properties": {
          "query": {
            "x-abbreviated": true,
            "type": "object",
            "description": "The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. By default, this property has the following value: `{\"match_all\": {}}`.\n",
            "externalDocs": {
              "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html",
              "description": "Query DSL"
            }
          }
...
      "transform._types:Source": {
        "type": "object",
        "properties": {
          "query": {
            "x-abbreviated": true,
            "type": "object",
            "description": "A query clause that retrieves a subset of data from the source index.\n",
            "externalDocs": {
              "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html",
              "description": "Query DSL"
            }
          }
...
      "ml._types:CategorizationAnalyzerDefinition": {
        "type": "object",
        "properties": {
           "tokenizer": {
            "x-abbreviated": true,
            "oneOf": [
              {
                "type": "object"
              },
              {
                "type": "string"
              }
            ],
            "description": "The name or definition of the tokenizer to use after character filters are applied. ...",
            "externalDocs": {
              "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-tokenizers.html",
              "description": "Tokenizer reference"
            }
          }

@lcawl lcawl added the OpenAPI label Sep 17, 2024
@lcawl lcawl marked this pull request as ready for review September 18, 2024 00:17
@lcawl lcawl changed the title Add overlay for query object in ML datafeed_config Add overlay for deep objects in ML analysis_config and datafeed_config Sep 18, 2024
@lcawl lcawl marked this pull request as draft September 18, 2024 18:40
@lcawl lcawl marked this pull request as ready for review September 18, 2024 19:00
@lcawl lcawl changed the title Add overlay for deep objects in ML analysis_config and datafeed_config Add overlay for deep objects in ML analysis_config, datafeed_config, and source Sep 18, 2024
@lcawl lcawl changed the title Add overlay for deep objects in ML analysis_config, datafeed_config, and source Add overlay for deep objects in ML analysis_config, datafeed_config, and transform source Sep 18, 2024
Copy link
Contributor

@szabosteve szabosteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some minor suggestions, otherwise LGTM!

docs/overlays/elasticsearch-shared-overlays.yaml Outdated Show resolved Hide resolved
docs/overlays/elasticsearch-shared-overlays.yaml Outdated Show resolved Hide resolved
docs/overlays/elasticsearch-shared-overlays.yaml Outdated Show resolved Hide resolved
docs/overlays/elasticsearch-shared-overlays.yaml Outdated Show resolved Hide resolved
docs/overlays/elasticsearch-shared-overlays.yaml Outdated Show resolved Hide resolved
docs/overlays/elasticsearch-shared-overlays.yaml Outdated Show resolved Hide resolved
lcawl and others added 6 commits September 19, 2024 09:02
Co-authored-by: István Zoltán Szabó <szabosteve@gmail.com>
Co-authored-by: István Zoltán Szabó <szabosteve@gmail.com>
Co-authored-by: István Zoltán Szabó <szabosteve@gmail.com>
Co-authored-by: István Zoltán Szabó <szabosteve@gmail.com>
Co-authored-by: István Zoltán Szabó <szabosteve@gmail.com>
Co-authored-by: István Zoltán Szabó <szabosteve@gmail.com>
@lcawl lcawl merged commit ca09d65 into main Sep 19, 2024
6 checks passed
@lcawl lcawl deleted the overlay-abbreviated branch September 19, 2024 16:04
lcawl added a commit that referenced this pull request Sep 23, 2024
…and transform source (#2904)


Co-authored-by: István Zoltán Szabó <szabosteve@gmail.com>
lcawl added a commit that referenced this pull request Sep 24, 2024
…and transform source (#2904)


Co-authored-by: István Zoltán Szabó <szabosteve@gmail.com>
lcawl added a commit that referenced this pull request Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants