Skip to content

Commit f76f3a7

Browse files
committedJan 3, 2019
Add some documentation
1 parent 4e8cd72 commit f76f3a7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
 

‎indices_get_aliases.go

+3
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ func (s *AliasesService) Do(ctx context.Context) (*AliasesResult, error) {
141141

142142
// -- Result of an alias request.
143143

144+
// AliasesResult is the outcome of calling AliasesService.Do.
144145
type AliasesResult struct {
145146
Indices map[string]indexResult
146147
}
@@ -154,6 +155,7 @@ type aliasResult struct {
154155
IsWriteIndex bool
155156
}
156157

158+
// IndicesByAlias returns all indices given a specific alias name.
157159
func (ar AliasesResult) IndicesByAlias(aliasName string) []string {
158160
var indices []string
159161
for indexName, indexInfo := range ar.Indices {
@@ -166,6 +168,7 @@ func (ar AliasesResult) IndicesByAlias(aliasName string) []string {
166168
return indices
167169
}
168170

171+
// HasAlias returns true if the index has a specific alias.
169172
func (ir indexResult) HasAlias(aliasName string) bool {
170173
for _, alias := range ir.Aliases {
171174
if alias.AliasName == aliasName {

‎indices_get_aliases_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func TestAliasesBuildURL(t *testing.T) {
7979
func TestAliases(t *testing.T) {
8080
var err error
8181

82-
//client := setupTestClientAndCreateIndex(t, SetTraceLog(log.New(os.Stdout, "", 0)))
82+
// client := setupTestClientAndCreateIndex(t, SetTraceLog(log.New(os.Stdout, "", 0)))
8383
client := setupTestClientAndCreateIndex(t)
8484

8585
// Some tweets

0 commit comments

Comments
 (0)
Please sign in to comment.