0
0
Fork 0

fix typos and bug removing from aliases

This commit is contained in:
Marty Schoch 2014-11-26 11:42:33 -05:00
parent fcab645f96
commit 0d2114a06b
3 changed files with 5 additions and 5 deletions

View File

@ -38,7 +38,7 @@ func (h *AliasHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
}
var aliasAction AliasAction
// interpret request body as index mapping
// interpret request body as alias actions
if len(requestBody) > 0 {
err := json.Unmarshal(requestBody, &aliasAction)
if err != nil {
@ -52,7 +52,7 @@ func (h *AliasHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
err = UpdateAlias(aliasAction.Alias, aliasAction.AddIndexes, aliasAction.RemoveIndexes)
if err != nil {
showError(w, req, fmt.Sprintf("error updating alia: %v", err), 400)
showError(w, req, fmt.Sprintf("error updating alias: %v", err), 400)
return
}

View File

@ -49,7 +49,7 @@ func (h *DeleteIndexHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
// now delete it
err := os.RemoveAll(h.indexPath(indexName))
if err != nil {
showError(w, req, fmt.Sprintf("error deletoing index: %v", err), 500)
showError(w, req, fmt.Sprintf("error deleting index: %v", err), 500)
return
}

View File

@ -106,8 +106,8 @@ func UpdateAlias(alias string, add, remove []string) error {
addIndexes[i] = addIndex
}
// build list of remove indexes
removeIndexes := make([]bleve.Index, len(add))
for i, removeIndexName := range add {
removeIndexes := make([]bleve.Index, len(remove))
for i, removeIndexName := range remove {
removeIndex, indexExists := indexNameMapping[removeIndexName]
if !indexExists {
return fmt.Errorf("index named '%s' does not exist", removeIndexName)