Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin_ES_cmds_test Part II #6426

Merged
merged 4 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tools/cli/admin_elastic_search_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ func toTimeStr(s interface{}) string {

// GenerateReport generate report for an aggregation query to ES
func GenerateReport(c *cli.Context) error {
output := getDeps(c).Output()

// use url command argument to create client
index, err := getRequiredOption(c, FlagIndex)
if err != nil {
Expand Down Expand Up @@ -380,7 +382,7 @@ func GenerateReport(c *cli.Context) error {
}

// Show result to terminal
table := tablewriter.NewWriter(os.Stdout)
table := tablewriter.NewWriter(output)
var headers []string
var groupby, bucket map[string]interface{}
var buckets []interface{}
Expand All @@ -390,7 +392,7 @@ func GenerateReport(c *cli.Context) error {
}
buckets = groupby["buckets"].([]interface{})
if len(buckets) == 0 {
fmt.Println("no matching bucket")
output.Write([]byte("no matching bucket"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add \n at the end of the string to match with previous behavior which was calling Println

return nil
}

Expand Down
Loading
Loading