I have an index with documents in elasticsearch, each document has 480 fields. What I'm trying to do is to search for a term (e.g. "apple"), and get all the unique field names that their value matches the search term. So if my docs are:
{
"field1": "123",
"field2": "apple stock",
"field3": "red apple",
},
{
"field1": "apple",
"field2": "apple stock",
"field3": "green apple",
}
What I would like to get as a result of the query is an aggregation like this:
{
"field1": ["apple"],
"field2": ["apple stock"],
"field3": ["red apple", "green apple"]
}
Since each doc has ~480 fields, I prefer to do a multi_match query and not a filter that has all the fields:
"query": {
"multi_match": {
"query": "apple",
"type": "phrase"
}
}
Is this query possible in elasticsearch?