Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ResponseOps][ES Query] Grouped over field is not populated correctly…
… when editing a rule (elastic#192297) Resolves elastic#191077 ## Summary This PR fixes a bug loading the `groupby` field when editing an ES query rule. While the form was loading fields from the index, the `fields` array was empty ([]). This wasn't caught by a truthy check, so `termField` was set to undefined as the fields array didn’t contain the selected field. As a result, the form failed to populate correctly. To fix this, I updated it to only check if the array contains the selected field when the array is defined and also not empty. I tested this for creating and editing the rule and it seemed to work, pls let me know if there is another scenario I am missing with this fix. ### To verify - Create an ES query rule with the `groupby` field set. See example below of what the bug looked like before. - Edit the rule and verify that the grouped by field is populated correctly. I would test it a couple times to verify **Example of Before:** <img width="895" alt="Screen Shot 2024-09-06 at 2 09 43 PM" src="https://github.com/user-attachments/assets/a03cebb5-4cc5-4d26-9e07-11e0ed120aef">
- Loading branch information