func()

in internal/mode/advanced/elastic/client.go [263:290]


func (c *Client) Index(documentType, id string, thing interface{}) {
	indexName := c.indexNameFor(documentType)
	routing := c.routingFor(documentType)
	req := elastic.NewBulkIndexRequest().
		Index(indexName).
		Routing(routing).
		Id(id).
		Doc(thing)

	if c.SearchCuration {
		if err := c.DeleteFromRolledOverIndices(&DeleteFromRolledOverIndicesParams{
			AliasName: indexName,
			DocType:   documentType,
			DocId:     id,
			Routing:   routing,
		}); err != nil {
			logkit.WithFields(
				logkit.Fields{
					"search_curation": indexName,
					"doc_id":          id,
					"doc_type":        documentType,
				},
			).WithError(err).Info("DeleteFromRolledOverIndices failed")
		}
	}

	c.bulk.Add(req)
}