Skip to content

Offer support to determine the size of a BulkOperation #425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fabian-froehlich opened this issue Oct 19, 2022 · 1 comment
Closed

Offer support to determine the size of a BulkOperation #425

fabian-froehlich opened this issue Oct 19, 2022 · 1 comment
Labels
Category: Enhancement New feature or request

Comments

@fabian-froehlich
Copy link

fabian-froehlich commented Oct 19, 2022

Description

Our application creates a Stream of objects that we write with an IndexRequest into ElasticSearch. The Stream is consumed in chunks.

The chunk size is determined by a few metrics that helped us stabilized the index Prozess. These are:

  • Number of Requests in BulkRequest
  • Accumulated Request-Size
    • Accumulated Body-Size (bulkRequest.estimatedSizeInBytes())
    • Accumulated Script Size (RamUsageEstimator.sizeOfMap(script.getParams()))

Is there already an utility inside elasticsearch-java that helps accommodate these requirements?

As far as I understand the new architecture correctly the serialization happens at the very end of the chain. But there might be a place where an estimation could happen? I would not like to serialize my objects twice. Once while building the BulkOperation-List and once while sending the request to ElasticSearch.

@swallez
Copy link
Member

swallez commented Jan 4, 2023

This is resolved by PR #474 that introduces a BinaryData type that can be used for bulk operation documents, and of which we can get the size in bytes.

This BinaryData can be either created directly, but it's also used transparently by the BulkIngester to evaluate the size of the bulk request.

@swallez swallez closed this as completed Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants