Skip to content

How to speed up indexing #1834

Answered by Thejas-bhat
kskarthik asked this question in Q&A
Jun 25, 2023 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

bleve supports indexing batch wise (which is less expensive at the end of the day when compared with directly indexing docs separately). what can be done is create a batch using:

batch := index.NewBatch()

and then put the docs inside the batch using
err := batch.Index(docID, doc)

and periodically (every 1000 docs for eg) index this batch using

err := index.Batch(batch)

also, the batch variable itself can be reused for indexing the next batch of docs by reseting the batch using batch.Reset() before the next operation.

Iterating the map itself can be done using the range functionality (for k, v := range map { ... }). The Fields map I believe is keyed by the field name and the value is conte…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@kskarthik
Comment options

@kskarthik
Comment options

@kskarthik
Comment options

Answer selected by kskarthik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants