Hi!
I wanted to know if there is a way to access data from my index (which contains multiple documents and each document contains different type of fields, for eg., one document might contain fields Aa, Ba and Ca whereas another document might contain fields Ba, Da.) without knowing the field names.
I have pasted my code snippet which works for index containing documents which have the same fields(for eg., every document contains fields Aa, Ba, Ca and Da.)
{
"$schema": "https://vega.github.io/schema/vega/v3.3.json",
"autosize": {
"type": "fit",
"resize": true
},
"data": [
{
"name": "table",
"url": {
"index": "xyz",
"body": {
"query": {
"bool": {
"must": [
"%dashboard_context-must_clause%"
],
"filter": [],
"should": [],
"must_not": [
"%dashboard_context-must_not_clause%"
]
}
}
},
"size": 10
},
"format": {
"property": "hits.hits"
}
},
// I want to make the underlying part of the code more generic
{
"name": "proj",
"source": "table",
"transform": [
{
"type": "project",
"fields": ["_source.AdditionalOutput.Aa", "_source.AdditionalOutput.Ba", "_source.AdditionalOutput.Ca", "_source.AdditionalOutput.Da", "_source.AdditionalOutput.Ea"],
"as": ["Aa", "Ba", "Ca", "Da", "Ea"]
}]
},
{
"name": "trans",
"source": "proj",
"transform": [
{
"type": "flatten",
"fields": [ "Aa", "Ba", "Ca", "Da", "Ea"]
}
]
}