CreateIndex creates a new index with mapping.
(mapping string)
| 72 | |
| 73 | // CreateIndex creates a new index with mapping. |
| 74 | func (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. |
| 86 | func (s *Store) Create(item *Document) error { |
no test coverage detected