When a request is sent to an Elasticsearch cluster, the returned JSON array may look like this:
[
{
"_type": "Event example",
"_source": {
"democarrier_s": "vodafone UK",
"m-Ecosystem_s": "iOS",
"demo-application": "demo",
"demo-country-code": "GB"
}
},
{
"_type": "Event example",
"_source": {
"democarrier_s": "Verizon",
"m-Ecosystem_s": "iOS",
"demo-application": "demo1",
"demo-country-code": "US"
}
}
]
One might wonder how to extract all unique keys from such a document without any repetition or hard-coded values. The goal is to store these keys into an object as follows:
columns = ['_type', '_source.democarrier_s', '_source.m-Ecosystem_s', '_source.demo-application', '_source.demo-country-code'];
If you have insights on how to approach this task efficiently, your input would be greatly appreciated. We appreciate any guidance or assistance provided.