is partial update a cpu intensive task in elasticsearch?

Viewed 50

I have a document type which at the time of getting Indexed has close to 60 fields. I do search, index and update operations on these documents.

My CPU consumption was just over 40 percent average before introducing one new change.

Recently i introduced a change, which at times i will be updating the indexed documents with 60 more new fields. So now in a whole 120 fields. With this new change i doubled the number of fields getting stored in each document.

Api: /_update/docId?retry_on_conflict=2

Payload: {"doc":{ "key61": "value61" , ... , "key120", "value120" }}

With this change my cpu usage is spiking over 75 percent.

Can someone help me understand what is causing this cpu spike?

1 Answers

I think culprit is update request, as it does extra computing of retrieving the document which needs to be updated, add/remove additional fields according to your update request and then again index the updated document.

This requires also the serializing/de-serializing the whole content which is costly espically when you have large number of fields and text content.

If instead of updating, you can send all 120 fields and use index operation IMO it will be much faster and you can benchmark it.

Related