elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
70k stars 24.76k forks source link

[Failure store] Use selectors in the Resolve API #115212

Open gmarouli opened 1 week ago

gmarouli commented 1 week ago

In the https://github.com/elastic/elasticsearch/pull/114992, we introduced the selector API in the multi-target syntax. We would like to suppor the :: syntax in the resolve API. For example:

# Resolve to everything, along with the data stream this would return other indices and aliases
GET /_resolve/index/my-ds*::*?expand_wildcards=all
{
  "indices": [                                 
    {
      "name": ".ds-my-ds-xxxxxx",
      "attributes": [
        "open",                       
      ],
     "data_stream": ["my-ds"]
    },
   {
      "name": ".fs-my-ds-xxxxxx",
      "attributes": [
        "open", "failure_store"                               
      ]
    }
  ],
  "aliases": [                                 
  ],
  "data_streams": [                            
    {
      "name": "my-ds",
      "backing_indices": [".ds-my-ds-xxxxxx"],
      "failure_indices": [".fs-my-ds-xxxxxx"],
      "timestamp_field": "@timestamp"
    }
  ]
} 

# This will resolve to only indices, data stream and aliases and not the failure store indices of the data stream (unless directly accessed)
GET /_resolve/index/my-ds*::data?expand_wildcards=all
{
  "indices": [                                 
    {
      "name": ".ds-my-ds-xxxxxx",
      "attributes": [
        "open",                       
      ],
     "data_stream": ["my-ds"]
    }
  ],
  "aliases": [                                 
  ],
  "data_streams": [                            
    {
      "name": "my-ds",
      "backing_indices": [".ds-my-ds-xxxxxx"],
      "timestamp_field": "@timestamp"
    }
  ]
}

# This will resolve to the failure indices of the data stream only. No standalone index will be included.
GET /_resolve/index/my-ds*::failures?expand_wildcards=all
{
  "indices": [                                 
    {
      "name": ".fs-my-ds-xxxxxx",
      "attributes": [
        "open", "failure_store"                               
      ]
    }
  ],
  "aliases": [                                 
  ],
  "data_streams": [                            
    {
      "name": "my-ds",
      "backing_indices": [],
     "failure_indices": [
        ".fs-my-ds-xxxxxx"
      ],
      "timestamp_field": "@timestamp"
    }
  ]
}
elasticsearchmachine commented 1 week ago

Pinging @elastic/es-data-management (Team:Data Management)