Get consolidated schema of multiple indices in ES

Hello,

I've multiple indices in Elasticsearch that has similar data. But, each index has new properties added/removed over the period of time. Is there any way to fetch union of all indices schema using KQL?

For example,

Index1_2020
{
   "id": "123",
   "name" :"es"
   "age" : 25
}

Index1_2021
{
   "id": "123",
   "name" :"es"
   "dept" : "hr"
   "sal" : "5000"
   "currencycode" : "USD"
}

With above two indices, "Age" is removed in Index_2020 and additional attributes are added in 2021 index. I've these indices mapped almost every month in my system for last few years. It would be tedious process to understand the schema manually. Wondering if there is any way we could get consolidated or Union schema of all these indices?

Here is the schema output I'm looking for

 "id"
   "name" 
  "age"
   "dept" 
   "sal" 
   "currencycode" 

I think I would create an index pattern or data view for the indices you are looking at depending on which version you're on and then that

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.