I'm using the Elasticsearch Bulk API to create or update documents.
I do actually know if they are creates or updates, but I can simplify my code by just making them all index, or "upserts" in the SQL sense.
Is there any disadvantage in using index (and letting ES figure it out) over using the more explicit create and update?
If you're sending
create, you must ensure that the document doesn't exist yet in your index otherwise the call will fail, whereas sending the same document withindexwill always succeed.Then, if for performance reasons, you know you'll create a document (with either
createorindex) and then you'll only update just a few properties, then usingupdatemight make sense.Otherwise, if you're always sending full documents, I'd use
indexall the time, for both creating and updating. Whenever it sees anindexaction, ES will either create the document if it doesn't exist or replace it if it exists, but the call will always succeed.