I am not sure whether it is correct or not. But I think that if I want to add data into existing index in elasticsearch using olivere in golang, the only option available is to delete the index and re index the data.
This is my code :
bulkRequest := client.Bulk()
for j := 0; j < 20; j++ {
n++
tweet := Tweet{User: "Rudi", Message: "This is the new from string representations of basic data types. " + strconv.Itoa(n)}
req :=
elastic.NewBulkIndexRequest().Index("employee").Type("tweet").Id(strconv.Itoa(n)).Doc(tweet)
bulkRequest.Add(req)
}
bulkResponse, err := bulkRequest.Do(context.Background())
Does anyone know a better solution?
Thanks