MCPcopy
hub / github.com/elastic/go-elasticsearch / CreateIndex

Method CreateIndex

_examples/xkcdsearch/store.go:74–83  ·  view source on GitHub ↗

CreateIndex creates a new index with mapping.

(mapping string)

Source from the content-addressed store, hash-verified

72
73// CreateIndex creates a new index with mapping.
74func (s *Store) CreateIndex(mapping string) error {
75 res, err := s.es.Indices.Create(s.indexName, s.es.Indices.Create.WithBody(strings.NewReader(mapping)))
76 if err != nil {
77 return err
78 }
79 if res.IsError() {
80 return fmt.Errorf("error: %s", res)
81 }
82 return nil
83}
84
85// Create indexes a new document into store.
86func (s *Store) Create(item *Document) error {

Callers 1

setupIndexMethod · 0.80

Calls 3

IsErrorMethod · 0.80
CreateMethod · 0.45
WithBodyMethod · 0.45

Tested by

no test coverage detected