-
Notifications
You must be signed in to change notification settings - Fork 0
/
engine_index.go
31 lines (24 loc) · 1.01 KB
/
engine_index.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package elasticx
import (
"context"
"github.com/elastic/go-elasticsearch/v8/typedapi/types"
)
// EngineIndexes provides access to all indexes in a single engine.
type EngineIndexes interface {
// Index opens a connection to an exisiting index within the engine.
// If no index with given name exists, a NotFoundError is returned.
Index(ctx context.Context, name string) (Index, error)
// IndexExists returns true if an index with given name exists within the engine.
IndexExists(ctx context.Context, name string) (bool, error)
// Indexes returns a list of all indexes in the engine.
Indexes(ctx context.Context) ([]Index, error)
// CreateIndex creates a new index,
// with given name, and opens a connection to it.
CreateIndex(ctx context.Context, name string, options *CreateIndexOptions) (Index, error)
}
// CreateIndexOptions contains options that customize the creation of an index.
type CreateIndexOptions struct {
Aliases map[string]types.Alias
Settings *types.IndexSettings
Mappings *types.TypeMapping
}