After #184890, we now have a function that can automatically fetch the necessary field mappings for fields in a query string. However, we don't always want to use this function, especially in loops, so it can be configured in 3 different ways: automatically load the fields, pass in a list of pre-fetched fields, or don't handle fields at all. We should refactor to split these use cases into different functions and make it more clear from the function name what the intent is instead of burying the detail in how the function parameters are set up.
https://github.com/elastic/kibana/pull/184890#discussion_r1631488622
After #184890, we now have a function that can automatically fetch the necessary field mappings for fields in a query string. However, we don't always want to use this function, especially in loops, so it can be configured in 3 different ways: automatically load the fields, pass in a list of pre-fetched fields, or don't handle fields at all. We should refactor to split these use cases into different functions and make it more clear from the function name what the intent is instead of burying the detail in how the function parameters are set up.