This repository was archived by the owner on Apr 15, 2025. It is now read-only.
File tree Expand file treeCollapse file tree 1 file changed+38
-0
lines changedFilter options
+38
-0
lines changed Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
1
+
package cli
2
+
3
+
import (
4
+
"fmt"
5
+
"os"
6
+
7
+
"github.com/spf13/cobra"
8
+
)
9
+
10
+
var indexToGetMappings string
11
+
12
+
func init() {
13
+
cmdIndexMappings.Flags().StringVarP(&indexToGetMappings, "index", "i", "", "Elasticsearch index to retrieve mappings from (required)")
14
+
err := cmdIndexMappings.MarkFlagRequired("index")
15
+
if err != nil {
16
+
fmt.Printf("Error binding name configuration flag: %s \n", err)
17
+
os.Exit(1)
18
+
}
19
+
rootCmd.AddCommand(cmdIndexMappings)
20
+
}
21
+
22
+
var cmdIndexMappings = &cobra.Command{
23
+
Use: "mappings",
24
+
Short: "Display the mappings of the specified index.",
25
+
Long: `Show the mappings of the specified index within the cluster.`,
26
+
Run: func(cmd *cobra.Command, args []string) {
27
+
28
+
v := getClient()
29
+
30
+
mappings, err := v.GetPrettyIndexMappings(indexToGetMappings)
31
+
32
+
if err != nil {
33
+
fmt.Printf("Error getting mappings: %s\n", err)
34
+
os.Exit(1)
35
+
}
36
+
fmt.Println(mappings)
37
+
},
38
+
}
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4