elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.7k stars 8.12k forks source link

Preview for match-all template gives error response #189555

Open masseyke opened 1 month ago

masseyke commented 1 month ago

I went to Stack Management -> Index Management, clicked on Index Templates, and Create Template. Then I created a template that matches index patterns *. The template was created find, and I was able to use it. But when I clicked on the Preview tab I got this:

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "index template [simulate_template_qdey_a06qjm8tepvpcfxfq] has index patterns [a_fake_index_pattern_that_wont_match_any_indices] matching patterns from existing templates [all-data-streams] with patterns (all-data-streams => [*]) that have the same priority [5], multiple index templates may not match during index creation, please use a different priority",
  "attributes": {
    "error": {
      "root_cause": [
        {
          "type": "illegal_argument_exception",
          "reason": "index template [simulate_template_qdey_a06qjm8tepvpcfxfq] has index patterns [a_fake_index_pattern_that_wont_match_any_indices] matching patterns from existing templates [all-data-streams] with patterns (all-data-streams => [*]) that have the same priority [5], multiple index templates may not match during index creation, please use a different priority"
        }
      ],
      "type": "illegal_argument_exception",
      "reason": "index template [simulate_template_qdey_a06qjm8tepvpcfxfq] has index patterns [a_fake_index_pattern_that_wont_match_any_indices] matching patterns from existing templates [all-data-streams] with patterns (all-data-streams => [*]) that have the same priority [5], multiple index templates may not match during index creation, please use a different priority"
    }
  }
}
elasticmachine commented 1 month ago

Pinging @elastic/kibana-management (Team:Kibana Management)

alisonelizabeth commented 1 week ago

@masseyke did you provide any other inputs as part of template creation in the UI? If you can copy the request from the "Request" tab in the summary that would be helpful.

Also, as I believe we are just returning the error that's coming back from ES, what do you think the best way to handle this is? Is there some validation we're missing in the UI?

masseyke commented 1 week ago

I just tried reproducing it on serverless. This was from an Observability serverless deployment: I clicked Project Settings -> Management -> Index Management I clicked Index Templates -> Create template I set the name to keith-test, the Index patterns to *, and the Priority to 700. Before clicking Create template, everything looked fine. Here's the request:

PUT _index_template/keith-test
{
  "priority": 700,
  "template": {},
  "index_patterns": [
    "*"
  ],
  "data_stream": {}
}

I clicked Create template, and that succeeded. But now if I click on Preview (in the box that popped up), I get this:

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "index template [simulate_template_rthntap9rzwrmbfm1bbadw] has index patterns [a_fake_index_pattern_that_wont_match_any_indices] matching patterns from existing templates [keith-test] with patterns (keith-test => [*]) that have the same priority [700], multiple index templates may not match during index creation, please use a different priority",
  "attributes": {
    "error": {
      "root_cause": [
        {
          "type": "illegal_argument_exception",
          "reason": "index template [simulate_template_rthntap9rzwrmbfm1bbadw] has index patterns [a_fake_index_pattern_that_wont_match_any_indices] matching patterns from existing templates [keith-test] with patterns (keith-test => [*]) that have the same priority [700], multiple index templates may not match during index creation, please use a different priority"
        }
      ],
      "type": "illegal_argument_exception",
      "reason": "index template [simulate_template_rthntap9rzwrmbfm1bbadw] has index patterns [a_fake_index_pattern_that_wont_match_any_indices] matching patterns from existing templates [keith-test] with patterns (keith-test => [*]) that have the same priority [700], multiple index templates may not match during index creation, please use a different priority"
    }
  }
}

I think that a_fake_index_pattern_that_wont_match_any_indices is coming from kibana and maybe causing the problems?