---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
- do:
    headers:
      Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=="
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    ml.put_trained_model:
      model_id: "a-regression-model-0"
      body: "{\n  \"description\": \"empty model for tests\",\n  \"tags\": [\"regression\"\
        , \"tag1\"],\n  \"input\": {\"field_names\": [\"field1\", \"field2\"]},\n\
        \  \"inference_config\": {\"regression\": {}},\n  \"definition\": {\n    \
        \ \"preprocessors\": [],\n     \"trained_model\": {\n        \"tree\": {\n\
        \           \"feature_names\": [\"field1\", \"field2\"],\n           \"tree_structure\"\
        : [\n              {\"node_index\": 0, \"leaf_value\": 1}\n           ],\n\
        \           \"target_type\": \"regression\"\n        }\n     }\n  }\n}\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    headers:
      Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=="
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    ml.put_trained_model:
      model_id: "a-regression-model-1"
      body: "{\n  \"description\": \"empty model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"tags\": [\"regression\", \"tag2\"],\n  \"\
        inference_config\": {\"regression\": {}},\n  \"definition\": {\n     \"preprocessors\"\
        : [],\n     \"trained_model\": {\n        \"tree\": {\n           \"feature_names\"\
        : [\"field1\", \"field2\"],\n           \"tree_structure\": [\n          \
        \    {\"node_index\": 0, \"leaf_value\": 1}\n           ],\n           \"\
        target_type\": \"regression\"\n        }\n     }\n  }\n}\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    headers:
      Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=="
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    ml.put_trained_model:
      model_id: "a-classification-model"
      body: "{\n  \"description\": \"empty model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"tags\": [\"classification\", \"tag2\"],\n\
        \  \"inference_config\": {\"classification\": {}},\n  \"definition\": {\n\
        \     \"preprocessors\": [],\n     \"trained_model\": {\n        \"tree\"\
        : {\n           \"feature_names\": [\"field1\", \"field2\"],\n           \"\
        tree_structure\": [\n              {\"node_index\": 0, \"leaf_value\": 1}\n\
        \           ],\n           \"target_type\": \"classification\",\n        \
        \   \"classification_labels\": [\"no\", \"yes\"]\n        }\n     }\n  }\n\
        }\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    headers:
      Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=="
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    ml.put_trained_model:
      model_id: "b-classification-model"
      body: "{\n  \"description\": \"empty model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"tags\": [\"classification\", \"tag2\"],\n\
        \  \"inference_config\": {\"classification\": {}},\n  \"definition\": {\n\
        \     \"preprocessors\": [],\n     \"trained_model\": {\n        \"tree\"\
        : {\n           \"feature_names\": [\"field1\", \"field2\"],\n           \"\
        tree_structure\": [\n              {\"node_index\": 0, \"leaf_value\": 1}\n\
        \           ],\n           \"target_type\": \"classification\",\n        \
        \   \"classification_labels\": [\"no\", \"yes\"]\n        }\n     }\n  }\n\
        }\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    headers:
      Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=="
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    ml.put_trained_model:
      model_id: "c-classification-model"
      body: "{\n  \"description\": \"empty model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"tags\": [\"classification\", \"tag2\"],\n\
        \  \"inference_config\": {\"classification\": {}},\n  \"definition\": {\n\
        \     \"preprocessors\": [],\n     \"trained_model\": {\n        \"tree\"\
        : {\n           \"feature_names\": [\"field1\", \"field2\"],\n           \"\
        tree_structure\": [\n              {\"node_index\": 0, \"leaf_value\": 1}\n\
        \           ],\n           \"target_type\": \"classification\",\n        \
        \   \"classification_labels\": [\"no\", \"yes\"]\n        }\n     }\n  }\n\
        }\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    headers:
      Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=="
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    ml.put_trained_model:
      model_id: "d-classification-model"
      body: "{\n  \"description\": \"empty model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"tags\": [\"classification\", \"tag2\"],\n\
        \  \"inference_config\": {\"classification\": {}},\n  \"definition\": {\n\
        \     \"preprocessors\": [],\n     \"trained_model\": {\n        \"tree\"\
        : {\n           \"feature_names\": [\"field1\", \"field2\"],\n           \"\
        tree_structure\": [\n              {\"node_index\": 0, \"leaf_value\": 1}\n\
        \           ],\n           \"target_type\": \"classification\",\n        \
        \   \"classification_labels\": [\"no\", \"yes\"]\n        }\n     }\n  }\n\
        }\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    headers:
      Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=="
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    ml.put_trained_model:
      model_id: "e-classification-model"
      body: "{\n  \"description\": \"empty model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"tags\": [\"classification\", \"tag2\"],\n\
        \  \"inference_config\": {\"classification\": {}},\n  \"definition\": {\n\
        \     \"preprocessors\": [],\n     \"trained_model\": {\n        \"tree\"\
        : {\n           \"feature_names\": [\"field1\", \"field2\"],\n           \"\
        tree_structure\": [\n              {\"node_index\": 0, \"leaf_value\": 1}\n\
        \           ],\n           \"target_type\": \"classification\",\n        \
        \   \"classification_labels\": [\"no\", \"yes\"]\n        }\n     }\n  }\n\
        }\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    headers:
      Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=="
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    ml.put_trained_model:
      model_id: "f-classification-model"
      body: "{\n  \"description\": \"empty model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"tags\": [\"classification\", \"tag2\"],\n\
        \  \"inference_config\": {\"classification\": {}},\n  \"definition\": {\n\
        \     \"preprocessors\": [],\n     \"trained_model\": {\n        \"tree\"\
        : {\n           \"feature_names\": [\"field1\", \"field2\"],\n           \"\
        tree_structure\": [\n              {\"node_index\": 0, \"leaf_value\": 1}\n\
        \           ],\n           \"target_type\": \"classification\",\n        \
        \   \"classification_labels\": [\"no\", \"yes\"]\n        }\n     }\n  }\n\
        }\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    headers:
      Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=="
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    ml.put_trained_model:
      model_id: "g-classification-model"
      body: "{\n  \"description\": \"empty model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"tags\": [\"classification\", \"tag2\"],\n\
        \  \"inference_config\": {\"classification\": {}},\n  \"definition\": {\n\
        \     \"preprocessors\": [],\n     \"trained_model\": {\n        \"tree\"\
        : {\n           \"feature_names\": [\"field1\", \"field2\"],\n           \"\
        tree_structure\": [\n              {\"node_index\": 0, \"leaf_value\": 1}\n\
        \           ],\n           \"target_type\": \"classification\",\n        \
        \   \"classification_labels\": [\"no\", \"yes\"]\n        }\n     }\n  }\n\
        }\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    headers:
      Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=="
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    ml.put_trained_model:
      model_id: "h-classification-model"
      body: "{\n  \"description\": \"empty model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"tags\": [\"classification\", \"tag2\"],\n\
        \  \"inference_config\": {\"classification\": {}},\n  \"definition\": {\n\
        \     \"preprocessors\": [],\n     \"trained_model\": {\n        \"tree\"\
        : {\n           \"feature_names\": [\"field1\", \"field2\"],\n           \"\
        tree_structure\": [\n              {\"node_index\": 0, \"leaf_value\": 1}\n\
        \           ],\n           \"target_type\": \"classification\",\n        \
        \   \"classification_labels\": [\"no\", \"yes\"]\n        }\n     }\n  }\n\
        }\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    headers:
      Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=="
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    ml.put_trained_model:
      model_id: "i-classification-model"
      body: "{\n  \"description\": \"empty model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"tags\": [\"classification\", \"tag2\"],\n\
        \  \"inference_config\": {\"classification\": {}},\n  \"definition\": {\n\
        \     \"preprocessors\": [],\n     \"trained_model\": {\n        \"tree\"\
        : {\n           \"feature_names\": [\"field1\", \"field2\"],\n           \"\
        tree_structure\": [\n              {\"node_index\": 0, \"leaf_value\": 1}\n\
        \           ],\n           \"target_type\": \"classification\",\n        \
        \   \"classification_labels\": [\"no\", \"yes\"]\n        }\n     }\n  }\n\
        }\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    headers:
      Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=="
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    ml.put_trained_model:
      model_id: "j-classification-model"
      body: "{\n  \"description\": \"empty model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"tags\": [\"classification\", \"tag2\"],\n\
        \  \"inference_config\": {\"classification\": {}},\n  \"definition\": {\n\
        \     \"preprocessors\": [],\n     \"trained_model\": {\n        \"tree\"\
        : {\n           \"feature_names\": [\"field1\", \"field2\"],\n           \"\
        tree_structure\": [\n              {\"node_index\": 0, \"leaf_value\": 1}\n\
        \           ],\n           \"target_type\": \"classification\",\n        \
        \   \"classification_labels\": [\"no\", \"yes\"]\n        }\n     }\n  }\n\
        }\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    headers:
      Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=="
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    ml.put_trained_model:
      model_id: "k-classification-model"
      body: "{\n  \"description\": \"empty model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"tags\": [\"classification\", \"tag2\"],\n\
        \  \"inference_config\": {\"classification\": {}},\n  \"definition\": {\n\
        \     \"preprocessors\": [],\n     \"trained_model\": {\n        \"tree\"\
        : {\n           \"feature_names\": [\"field1\", \"field2\"],\n           \"\
        tree_structure\": [\n              {\"node_index\": 0, \"leaf_value\": 1}\n\
        \           ],\n           \"target_type\": \"classification\",\n        \
        \   \"classification_labels\": [\"no\", \"yes\"]\n        }\n     }\n  }\n\
        }\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    headers:
      Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=="
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    ml.put_trained_model:
      model_id: "y-classification-model"
      body: "{\n  \"description\": \"empty model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"tags\": [\"classification\", \"tag3\"],\n\
        \  \"inference_config\": {\"classification\": {}},\n  \"definition\": {\n\
        \     \"preprocessors\": [],\n     \"trained_model\": {\n        \"tree\"\
        : {\n           \"feature_names\": [\"field1\", \"field2\"],\n           \"\
        tree_structure\": [\n              {\"node_index\": 0, \"leaf_value\": 1}\n\
        \           ],\n           \"target_type\": \"classification\",\n        \
        \   \"classification_labels\": [\"no\", \"yes\"]\n        }\n     }\n  }\n\
        }\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    headers:
      Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=="
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    ml.put_trained_model:
      model_id: "z-classification-model"
      body: "{\n  \"description\": \"empty model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"tags\": [\"classification\", \"tag3\"],\n\
        \  \"inference_config\": {\"classification\": {}},\n  \"definition\": {\n\
        \     \"preprocessors\": [],\n     \"trained_model\": {\n        \"tree\"\
        : {\n           \"feature_names\": [\"field1\", \"field2\"],\n           \"\
        tree_structure\": [\n              {\"node_index\": 0, \"leaf_value\": 1}\n\
        \           ],\n           \"target_type\": \"classification\",\n        \
        \   \"classification_labels\": [\"no\", \"yes\"]\n        }\n     }\n  }\n\
        }\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test get given missing trained model:
- do:
    catch: "missing"
    ml.get_trained_models:
      model_id: "missing-trained-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test get given expression without matches and allow_no_match is false:
- do:
    catch: "missing"
    ml.get_trained_models:
      model_id: "missing-trained-model*"
      allow_no_match: false
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test get given expression without matches and allow_no_match is true:
- do:
    ml.get_trained_models:
      model_id: "missing-trained-model*"
      allow_no_match: true
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 0
- match:
    trained_model_configs: []
---
Test get models:
- do:
    ml.get_trained_models:
      model_id: "*"
      size: 10
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 16
- length:
    trained_model_configs: 10
- do:
    ml.get_trained_models:
      model_id: "*"
      size: 100
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 16
- length:
    trained_model_configs: 16
- do:
    ml.get_trained_models:
      model_id: "a-regression*"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 2
- length:
    trained_model_configs: 2
- match:
    trained_model_configs.0.model_id: "a-regression-model-0"
- match:
    trained_model_configs.1.model_id: "a-regression-model-1"
- do:
    ml.get_trained_models:
      model_id: "*"
      from: 0
      size: 2
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 16
- length:
    trained_model_configs: 2
- match:
    trained_model_configs.0.model_id: "a-classification-model"
- match:
    trained_model_configs.1.model_id: "a-regression-model-0"
- do:
    ml.get_trained_models:
      model_id: "*"
      from: 1
      size: 1
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 16
- length:
    trained_model_configs: 1
- match:
    trained_model_configs.0.model_id: "a-regression-model-0"
- do:
    ml.get_trained_models:
      model_id: "*"
      from: 2
      size: 2
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 16
- length:
    trained_model_configs: 2
- match:
    trained_model_configs.0.model_id: "a-regression-model-1"
- match:
    trained_model_configs.1.model_id: "b-classification-model"
- do:
    ml.get_trained_models:
      model_id: "*"
      from: 13
      size: 1
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 16
- length:
    trained_model_configs: 1
- match:
    trained_model_configs.0.model_id: "lang_ident_model_1"
- do:
    ml.get_trained_models:
      model_id: "*"
      from: 13
      size: 2
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 16
- length:
    trained_model_configs: 2
- match:
    trained_model_configs.0.model_id: "lang_ident_model_1"
- match:
    trained_model_configs.1.model_id: "y-classification-model"
- do:
    ml.get_trained_models:
      model_id: "*"
      from: 14
      size: 2
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 16
- length:
    trained_model_configs: 2
- match:
    trained_model_configs.0.model_id: "y-classification-model"
- match:
    trained_model_configs.1.model_id: "z-classification-model"
- do:
    ml.get_trained_models:
      model_id: "a-*,lang*,z*"
      allow_no_match: true
      from: 3
      size: 1
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 5
- length:
    trained_model_configs: 1
- match:
    trained_model_configs.0.model_id: "lang_ident_model_1"
- do:
    ml.get_trained_models:
      model_id: "a-*,lang*,z*"
      allow_no_match: true
      from: 4
      size: 1
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 5
- length:
    trained_model_configs: 1
- match:
    trained_model_configs.0.model_id: "z-classification-model"
- do:
    ml.get_trained_models:
      model_id: "a-*,lang*,z*"
      from: 4
      size: 100
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 5
- length:
    trained_model_configs: 1
- match:
    trained_model_configs.0.model_id: "z-classification-model"
---
Test get models with tags:
- do:
    ml.get_trained_models:
      model_id: "*"
      tags: "regression,tag1"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 1
- match:
    trained_model_configs.0.model_id: "a-regression-model-0"
- do:
    ml.get_trained_models:
      model_id: "a-regression*"
      tags: "tag1"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 1
- match:
    trained_model_configs.0.model_id: "a-regression-model-0"
- do:
    ml.get_trained_models:
      model_id: "*"
      tags: "tag2"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 12
- match:
    trained_model_configs.0.model_id: "a-classification-model"
- match:
    trained_model_configs.1.model_id: "a-regression-model-1"
- do:
    ml.get_trained_models:
      model_id: "*"
      tags: "tag2"
      from: 1
      size: 1
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 12
- match:
    trained_model_configs.0.model_id: "a-regression-model-1"
---
Test delete given unused trained model:
- do:
    ml.delete_trained_model:
      model_id: "a-classification-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    acknowledged: true
---
Test delete with missing model:
- do:
    catch: "missing"
    ml.delete_trained_model:
      model_id: "missing-trained-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test delete given model referenced by pipeline:
- skip:
    awaits_fix: "https://github.com/elastic/elasticsearch/issues/80703"
- do:
    ingest.put_pipeline:
      id: "pipeline-using-a-classification-model"
      body: "{\n  \"processors\": [\n    {\n      \"inference\": {\n        \"model_id\"\
        : \"a-classification-model\",\n        \"target_field\": \"infer_result\"\
        ,\n        \"inference_config\": { \"classification\": {} }\n      }\n   \
        \ }\n  ]\n}\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    catch: "/Cannot delete model \\[a-classification-model\\] as it is still referenced\
      \ by ingest processors; use force to delete the model/"
    ml.delete_trained_model:
      model_id: "a-classification-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ingest.delete_pipeline:
      id: "pipeline-using-a-classification-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test force delete given model referenced by pipeline:
- skip:
    awaits_fix: "https://github.com/elastic/elasticsearch/issues/80703"
- do:
    ingest.put_pipeline:
      id: "pipeline-using-a-classification-model"
      body: "{\n  \"processors\": [\n    {\n      \"inference\": {\n        \"model_id\"\
        : \"a-classification-model\",\n        \"target_field\": \"infer_result\"\
        ,\n        \"inference_config\": { \"classification\": {} }\n      }\n   \
        \ }\n  ]\n}\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ml.delete_trained_model:
      model_id: "a-classification-model"
      force: true
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    acknowledged: true
- do:
    ingest.delete_pipeline:
      id: "pipeline-using-a-classification-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test delete given model with alias referenced by pipeline:
- skip:
    awaits_fix: "https://github.com/elastic/elasticsearch/issues/80703"
- do:
    ml.put_trained_model_alias:
      model_alias: "alias-to-a-classification-model"
      model_id: "a-classification-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ingest.put_pipeline:
      id: "pipeline-using-a-classification-model"
      body: "{\n  \"processors\": [\n    {\n      \"inference\": {\n        \"model_id\"\
        : \"alias-to-a-classification-model\",\n        \"target_field\": \"infer_result\"\
        ,\n        \"inference_config\": { \"classification\": {} }\n      }\n   \
        \ }\n  ]\n}\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    catch: "/Cannot delete model \\[a-classification-model\\] as it has a model_alias\
      \ \\[alias-to-a-classification-model\\] that is still referenced by ingest processors;\
      \ use force to delete the model/"
    ml.delete_trained_model:
      model_id: "a-classification-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ingest.delete_pipeline:
      id: "pipeline-using-a-classification-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test force delete given model with alias referenced by pipeline:
- skip:
    awaits_fix: "https://github.com/elastic/elasticsearch/issues/106652"
- do:
    ml.put_trained_model_alias:
      model_alias: "alias-to-a-classification-model"
      model_id: "a-classification-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ingest.put_pipeline:
      id: "pipeline-using-a-classification-model"
      body: "{\n  \"processors\": [\n    {\n      \"inference\": {\n        \"model_id\"\
        : \"alias-to-a-classification-model\",\n        \"target_field\": \"infer_result\"\
        ,\n        \"inference_config\": { \"classification\": {} }\n      }\n   \
        \ }\n  ]\n}\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ml.delete_trained_model:
      model_id: "a-classification-model"
      force: true
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    acknowledged: true
- do:
    ingest.delete_pipeline:
      id: "pipeline-using-a-classification-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test get pre-packaged trained models:
- do:
    ml.get_trained_models:
      model_id: "lang_ident_model_1"
      allow_no_match: false
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 1
- match:
    trained_model_configs.0.model_id: "lang_ident_model_1"
---
Test put ensemble with single node and empty feature_names:
- do:
    ml.put_trained_model:
      model_id: "ensemble_tree_empty_feature_names"
      body: "{\n  \"input\": {\n    \"field_names\": \"fieldy_mc_fieldname\"\n  },\n\
        \  \"inference_config\": {\"regression\": {}},\n  \"definition\": {\n    \"\
        trained_model\": {\n      \"ensemble\": {\n        \"feature_names\": [],\n\
        \        \"trained_models\": [\n           {\n              \"tree\": {\n\
        \                 \"feature_names\": [],\n                 \"tree_structure\"\
        : [\n                   {\n                     \"node_index\": 0,\n     \
        \                \"decision_type\": \"lte\",\n                     \"leaf_value\"\
        : 12.0,\n                     \"default_left\": true\n                   }]\n\
        \              }\n           }\n        ]\n      }\n    }\n  }\n}\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test put ensemble with empty models:
- do:
    catch: "/\\[trained_models\\] must not be empty/"
    ml.put_trained_model:
      model_id: "missing_model_ensembles"
      body: "{\n  \"input\": {\n    \"field_names\": \"fieldy_mc_fieldname\"\n  },\n\
        \  \"inference_config\": {\"regression\": {}},\n  \"definition\": {\n    \"\
        trained_model\": {\n      \"ensemble\": {\n        \"feature_names\": [],\n\
        \        \"trained_models\": []\n      }\n    }\n  }\n}\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test put ensemble with tree where tree has out of bounds feature_names index:
- do:
    catch: "/feature index \\[1\\] is out of bounds for the \\[feature_names\\] array/"
    ml.put_trained_model:
      model_id: "ensemble_tree_out_of_bounds_feature_names_index"
      body: "{\n  \"input\": {\n    \"field_names\": \"fieldy_mc_fieldname\"\n  },\n\
        \  \"inference_config\": {\"regression\": {}},\n  \"definition\": {\n    \"\
        trained_model\": {\n      \"ensemble\": {\n        \"feature_names\": [],\n\
        \        \"trained_models\": [\n           {\n              \"tree\": {\n\
        \                 \"feature_names\": [],\n                 \"tree_structure\"\
        : [\n                   {\n                     \"node_index\": 0,\n     \
        \                \"split_feature\": 1,\n                     \"split_gain\"\
        : 12.0,\n                     \"threshold\": 10.0,\n                     \"\
        decision_type\": \"lte\",\n                     \"default_left\": true,\n\
        \                     \"left_child\": 1,\n                     \"right_child\"\
        : 2\n                   }]\n              }\n           }\n        ]\n   \
        \   }\n    }\n  }\n}\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test put model with empty input.field_names:
- do:
    catch: "/\\[input\\.field_names\\] must not be empty/"
    ml.put_trained_model:
      model_id: "missing_model_ensembles"
      body: "{\n  \"input\": {\n    \"field_names\": []\n  },\n  \"inference_config\"\
        : {\"regression\": {}},\n  \"definition\": {\n    \"trained_model\": {\n \
        \     \"ensemble\": {\n        \"feature_names\": [],\n        \"trained_models\"\
        : [\n           {\n              \"tree\": {\n                 \"feature_names\"\
        : [],\n                 \"tree_structure\": [\n                   {\n    \
        \                 \"node_index\": 0,\n                     \"split_feature\"\
        : 0,\n                     \"split_gain\": 12.0,\n                     \"\
        threshold\": 10.0,\n                     \"decision_type\": \"lte\",\n   \
        \                  \"default_left\": true,\n                     \"left_child\"\
        : 1,\n                     \"right_child\": 2\n                   }]\n   \
        \           }\n           }\n        ]\n      }\n    }\n  }\n}\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test put model:
- do:
    ml.put_trained_model:
      model_id: "my-regression-model"
      body: "{\n  \"description\": \"model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"inference_config\": {\"regression\": {}},\n\
        \  \"definition\": {\n     \"preprocessors\": [],\n     \"trained_model\"\
        : {\n        \"ensemble\": {\n          \"target_type\": \"regression\",\n\
        \          \"trained_models\": [\n            {\n              \"tree\": {\n\
        \                \"feature_names\": [\"field1\", \"field2\"],\n          \
        \      \"tree_structure\": [\n                   {\"node_index\": 0, \"threshold\"\
        : 2, \"left_child\": 1, \"right_child\": 2},\n                   {\"node_index\"\
        : 1, \"leaf_value\": 0},\n                   {\"node_index\": 2, \"leaf_value\"\
        : 1}\n                ],\n                \"target_type\": \"regression\"\n\
        \              }\n            },\n            {\n              \"tree\": {\n\
        \                \"feature_names\": [\"field1\", \"field2\"],\n          \
        \      \"tree_structure\": [\n                   {\"node_index\": 0, \"threshold\"\
        : 2, \"left_child\": 1, \"right_child\": 2},\n                   {\"node_index\"\
        : 1, \"leaf_value\": 0},\n                   {\"node_index\": 2, \"leaf_value\"\
        : 1}\n                ],\n                \"target_type\": \"regression\"\n\
        \              }\n            }\n          ]\n        }\n     }\n  }\n}\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    model_id: "my-regression-model"
- match:
    estimated_operations: 6
- is_false: "definition"
- is_false: "compressed_definition"
- is_true: "license_level"
- is_true: "create_time"
- is_true: "version"
- is_true: "model_size_bytes"
---
Test PUT model where target type and inference config mismatch:
- do:
    catch: "/Model \\[my-regression-model\\] inference config type \\[classification\\\
      ] does not support definition target type \\[regression\\]/"
    ml.put_trained_model:
      model_id: "my-regression-model"
      body: "{\n  \"description\": \"model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"inference_config\": {\"classification\"\
        : {}},\n  \"definition\": {\n     \"preprocessors\": [],\n     \"trained_model\"\
        : {\n        \"ensemble\": {\n          \"target_type\": \"regression\",\n\
        \          \"trained_models\": [\n            {\n              \"tree\": {\n\
        \                \"feature_names\": [\"field1\", \"field2\"],\n          \
        \      \"tree_structure\": [\n                   {\"node_index\": 0, \"threshold\"\
        : 2, \"left_child\": 1, \"right_child\": 2},\n                   {\"node_index\"\
        : 1, \"leaf_value\": 0},\n                   {\"node_index\": 2, \"leaf_value\"\
        : 1}\n                ],\n                \"target_type\": \"regression\"\n\
        \              }\n            },\n            {\n              \"tree\": {\n\
        \                \"feature_names\": [\"field1\", \"field2\"],\n          \
        \      \"tree_structure\": [\n                   {\"node_index\": 0, \"threshold\"\
        : 2, \"left_child\": 1, \"right_child\": 2},\n                   {\"node_index\"\
        : 1, \"leaf_value\": 0},\n                   {\"node_index\": 2, \"leaf_value\"\
        : 1}\n                ],\n                \"target_type\": \"regression\"\n\
        \              }\n            }\n          ]\n        }\n     }\n  }\n}\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test exclude_generated flag:
- do:
    ml.get_trained_models:
      model_id: "a-regression-model-1"
      exclude_generated: true
      include: "definition"
      decompress_definition: false
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    trained_model_configs.0.description: "empty model for tests"
- match:
    trained_model_configs.0.model_id: "a-regression-model-1"
- is_true: "trained_model_configs.0.compressed_definition"
- is_true: "trained_model_configs.0.input"
- is_true: "trained_model_configs.0.inference_config"
- is_true: "trained_model_configs.0.tags"
- is_false: "trained_model_configs.0.created_by"
- is_false: "trained_model_configs.0.version"
- is_false: "trained_model_configs.0.create_time"
- is_false: "trained_model_configs.0.estimated_heap_memory_usage"
- is_false: "trained_model_configs.0.estimated_operations"
- is_false: "trained_model_configs.0.license_level"
---
Test deprecation of include model definition param:
- skip:
    features: "warnings"
    awaits_fix: "Query parameter removed"
- do:
    warnings:
    - "[include_model_definition] parameter is deprecated! Use [include=definition]\
      \ instead."
    ml.get_trained_models:
      model_id: "a-regression-model-1"
      include_model_definition: true
      decompress_definition: false
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test put model model aliases:
- do:
    ml.put_trained_model_alias:
      model_alias: "regression-model"
      model_id: "a-regression-model-1"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ml.get_trained_models:
      model_id: "regression-model,a-classification-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 2
- length:
    trained_model_configs: 2
- match:
    trained_model_configs.0.model_id: "a-classification-model"
- match:
    trained_model_configs.1.model_id: "a-regression-model-1"
- do:
    ml.put_trained_model_alias:
      model_alias: "regression-model"
      model_id: "a-regression-model-0"
      reassign: true
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ml.get_trained_models:
      model_id: "regression-model,a-classification-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 2
- length:
    trained_model_configs: 2
- match:
    trained_model_configs.0.model_id: "a-classification-model"
- match:
    trained_model_configs.1.model_id: "a-regression-model-0"
- do:
    ml.put_trained_model_alias:
      model_alias: "regression-model-again"
      model_id: "a-regression-model-0"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ml.get_trained_models:
      model_id: "a-regression-model-*"
      size: 1
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- length:
    trained_model_configs: 1
- match:
    trained_model_configs.0.model_id: "a-regression-model-0"
- match:
    trained_model_configs.0.metadata.model_aliases.0: "regression-model"
- match:
    trained_model_configs.0.metadata.model_aliases.1: "regression-model-again"
---
Test update model alias with model id referring to missing model:
- do:
    catch: "missing"
    ml.put_trained_model_alias:
      model_alias: "regression-model"
      model_id: "missing-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test update model alias with bad alias:
- do:
    catch: "/must start with alphanumeric and cannot end with numbers/"
    ml.put_trained_model_alias:
      model_alias: "regression-model-123123"
      model_id: "regression-model-123123"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    catch: "bad_request"
    ml.put_trained_model_alias:
      model_alias: "z-classification-model"
      model_id: "z-classification-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test update model alias where alias exists but old model id is different inference type:
- do:
    ml.put_trained_model_alias:
      model_alias: "regression-model"
      model_id: "a-regression-model-0"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    catch: "bad_request"
    ml.put_trained_model_alias:
      model_alias: "regression-model"
      model_id: "a-classification-model"
      reassign: true
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test update model alias where alias exists but reassign is false:
- do:
    ml.put_trained_model_alias:
      model_alias: "regression-model"
      model_id: "a-regression-model-0"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    catch: "bad_request"
    ml.put_trained_model_alias:
      model_alias: "regression-model"
      model_id: "a-regression-model-1"
      reassign: false
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test delete model alias:
- do:
    ml.put_trained_model_alias:
      model_alias: "regression-model"
      model_id: "a-regression-model-0"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ml.get_trained_models:
      model_id: "regression-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 1
- length:
    trained_model_configs: 1
- match:
    trained_model_configs.0.model_id: "a-regression-model-0"
- do:
    ml.delete_trained_model_alias:
      model_alias: "regression-model"
      model_id: "a-regression-model-0"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    catch: "missing"
    ml.get_trained_models:
      model_id: "regression-model"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test delete model alias with missing alias:
- do:
    catch: "missing"
    ml.delete_trained_model_alias:
      model_alias: "regression-model"
      model_id: "a-regression-model-0"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test delete model alias where alias points to different model:
- do:
    ml.put_trained_model_alias:
      model_alias: "regression-model"
      model_id: "a-regression-model-1"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    catch: "conflict"
    ml.delete_trained_model_alias:
      model_alias: "regression-model"
      model_id: "a-regression-model-0"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test put with defer_definition_decompression with invalid compressed definition:
- do:
    ml.put_trained_model:
      defer_definition_decompression: true
      model_id: "my-regression-model-with-bad-compressed-definition"
      body: "{\n  \"description\": \"model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"inference_config\": {\"classification\"\
        : {}},\n  \"model_size_bytes\": 1024,\n  \"compressed_definition\": \"H4sIAAAAAAAAAEy92a5mW26l9y55HWdj9o3u9RS+SMil4yrBUgpIpywY9fLmR3LMFSpI\"\
        \n}\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test put with defer_definition_decompression with invalid compression definition and no memory estimate:
- do:
    catch: "/when \\[defer_definition_decompression\\] is true and a compressed definition\
      \ is provided, model_size_bytes must be set/"
    ml.put_trained_model:
      defer_definition_decompression: true
      model_id: "my-regression-model-compressed-failed"
      body: "{\n  \"description\": \"model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"inference_config\": {\"classification\"\
        : {}},\n  \"compressed_definition\": \"H4sIAAAAAAAAAEy92a5mW26l9y55HWdj9o3u9RS+SMil4yrBUgpIpywY9fLmR3LMFSpI\"\
        \n}\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test put with defer_definition_decompression with invalid definition and no memory estimate:
- skip:
    awaits_fix: "https://github.com/elastic/elasticsearch/issues/94854"
- do:
    catch: "/Model \\[my-regression-model\\] inference config type \\[classification\\\
      ] does not support definition target type \\[regression\\]/"
    ml.put_trained_model:
      defer_definition_decompression: true
      model_id: "my-regression-model"
      body: "{\n  \"description\": \"model for tests\",\n  \"input\": {\"field_names\"\
        : [\"field1\", \"field2\"]},\n  \"inference_config\": {\"classification\"\
        : {}},\n  \"definition\": {\n     \"preprocessors\": [],\n     \"trained_model\"\
        : {\n        \"ensemble\": {\n          \"target_type\": \"regression\",\n\
        \          \"trained_models\": [\n            {\n              \"tree\": {\n\
        \                \"feature_names\": [\"field1\", \"field2\"],\n          \
        \      \"tree_structure\": [\n                   {\"node_index\": 0, \"threshold\"\
        : 2, \"left_child\": 1, \"right_child\": 2},\n                   {\"node_index\"\
        : 1, \"leaf_value\": 0},\n                   {\"node_index\": 2, \"leaf_value\"\
        : 1}\n                ],\n                \"target_type\": \"regression\"\n\
        \              }\n            },\n            {\n              \"tree\": {\n\
        \                \"feature_names\": [\"field1\", \"field2\"],\n          \
        \      \"tree_structure\": [\n                   {\"node_index\": 0, \"threshold\"\
        : 2, \"left_child\": 1, \"right_child\": 2},\n                   {\"node_index\"\
        : 1, \"leaf_value\": 0},\n                   {\"node_index\": 2, \"leaf_value\"\
        : 1}\n                ],\n                \"target_type\": \"regression\"\n\
        \              }\n            }\n          ]\n        }\n     }\n  }\n}\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test put nlp model config with vocabulary set:
- do:
    catch: "/illegal setting \\[vocabulary\\] on inference model creation/"
    ml.put_trained_model:
      model_id: "distilbert-finetuned-sst"
      body: "{\n  \"description\": \"distilbert-base-uncased-finetuned-sst-2-english.pt\"\
        ,\n  \"model_type\": \"pytorch\",\n  \"inference_config\": {\n    \"ner\"\
        : {\n      \"vocabulary\": {\n        \"index\": \".ml-inference-native\"\n\
        \      }\n    }\n  }\n}\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test include model definition status:
- do:
    ml.put_trained_model:
      model_id: "model-without-definition"
      body: "{\n  \"model_type\": \"pytorch\",\n  \"inference_config\": {\n    \"\
        ner\": {\n    }\n  }\n}\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ml.get_trained_models:
      model_id: "model-without-definition"
      include: "definition_status"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 1
- match:
    trained_model_configs.0.fully_defined: false
- do:
    ml.get_trained_models:
      model_id: "model-without-definition"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 1
- match:
    trained_model_configs.0.fully_defined: null
- do:
    catch: "/Getting the model download status is not supported when getting more\
      \ than one model/"
    ml.get_trained_models:
      model_id: "_all"
      include: "definition_status"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    catch: "/Definition status is only relevant to PyTorch model types/"
    ml.get_trained_models:
      model_id: "a-regression-model-0"
      include: "definition_status"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test include model platform architecture:
- do:
    ml.put_trained_model:
      model_id: "model-without-definition"
      body: "{\n  \"model_type\": \"pytorch\",\n  \"inference_config\": {\n    \"\
        ner\": {\n    }\n  },\n\"platform_architecture\": \"windows-x86_64\" }\n"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ml.get_trained_models:
      model_id: "model-without-definition"
      include: "definition_status"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 1
- match:
    trained_model_configs.0.fully_defined: false
- do:
    ml.get_trained_models:
      model_id: "model-without-definition"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    count: 1
- match:
    trained_model_configs.0.platform_architecture: "windows-x86_64"
