mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 09:54:18 +02:00
add sort support to search, add index fields command, fix error messages (#25)
This commit is contained in:
@@ -53,7 +53,7 @@ func DocAdd(conf *cfg.Config, jsondoc string) error {
|
||||
Header("accept", "application/json").
|
||||
Do(context.Background())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create new doc in index %s: %s", conf.Index, err)
|
||||
return fmt.Errorf("failed to create new doc in index %s: %s", conf.Index, esErrorString(err))
|
||||
}
|
||||
|
||||
fmt.Println(res.Id_)
|
||||
@@ -67,7 +67,7 @@ func DocShow(conf *cfg.Config, id string) error {
|
||||
Header("accept", "application/json").
|
||||
Do(context.Background())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to retrieve doc in index %s: %s", conf.Index, err)
|
||||
return fmt.Errorf("failed to retrieve doc in index %s: %s", conf.Index, esErrorString(err))
|
||||
}
|
||||
|
||||
if !res.Found {
|
||||
@@ -100,7 +100,7 @@ func DocDelete(conf *cfg.Config, queries []string) error {
|
||||
Header("accept", "application/json").
|
||||
Do(context.Background())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to delete doc in index %s: %s", conf.Index, err)
|
||||
return fmt.Errorf("failed to delete doc in index %s: %s", conf.Index, esErrorString(err))
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -125,7 +125,7 @@ func DocDelete(conf *cfg.Config, queries []string) error {
|
||||
Header("accept", "application/json").
|
||||
Do(context.Background())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to delete docs in index %s: %s", conf.Index, err)
|
||||
return fmt.Errorf("failed to delete docs in index %s: %s", conf.Index, esErrorString(err))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user