Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "es-tasks-list", Short: "Show tasks list for ElasticSearch", Long: `Show ongoing tasks/queries like you can do on a MariaDB server.`, Run: func(cmd *cobra.Command, args []string) { options := generateOptions() es, err := elasticsearch.NewClient(elasticsearch.Config{ Addresses: []string{ buildElasticSearchURL(), }, }) if err != nil { log.Fatalf("Error creating the client: %s", err) } req := esapi.TasksListRequest{ Actions: args, Detailed: &detailed, Human: true, } result, err := req.Do(context.Background(), es) if err != nil { log.Fatalf("Error while getting tasks list: %s", err) } defer result.Body.Close() var data map[string]interface{} if err := json.NewDecoder(result.Body).Decode(&data); err != nil { log.Fatalf("Error parsing the response body: %s", err) } utils.PrintTasks(data, options) }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.