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

Method Exists

_examples/xkcdsearch/store.go:115–128  ·  view source on GitHub ↗

Exists returns true when a document with id already exists in the store.

(id string)

Source from the content-addressed store, hash-verified

113
114// Exists returns true when a document with id already exists in the store.
115func (s *Store) Exists(id string) (bool, error) {
116 res, err := s.es.Exists(s.indexName, id)
117 if err != nil {
118 return false, err
119 }
120 switch res.StatusCode {
121 case 200:
122 return true, nil
123 case 404:
124 return false, nil
125 default:
126 return false, fmt.Errorf("[%s]", res.Status())
127 }
128}
129
130// Search returns results matching a query, paginated by after.
131func (s *Store) Search(query string, after ...string) (*SearchResults, error) {

Callers 6

existsDocumentMethod · 0.45
mainFunction · 0.45
runFunction · 0.45
setupIndexFunction · 0.45
setupIndexFunction · 0.45
mainFunction · 0.45

Calls 1

StatusMethod · 0.45

Tested by

no test coverage detected