Skip to content

Got an error "Request Entity Too Large" when creating index pattern in AWS Opensearch

0

When I tried to create index pattern in aws opensearch, I got an error like below image. 여기에 이미지 설명 입력

Index i tried to create pattern has more then 3500 fields. It might be the reason of error, but then how can i solve this problem?

  • please accept the answer if it was helpful

asked 2 years ago1.9K views
2 Answers
1

The "Request Entity Too Large" error in AWS OpenSearch usually occurs when the request payload exceeds the size limits set by the service. This can happen when trying to create an index pattern with a very large number of fields. Here are a few steps you can take to resolve this issue:

Solutions 1. Reduce the Number of Fields:

  • Reevaluate the Index Mapping: Ensure that all the fields are necessary. Sometimes, data can be structured more efficiently, reducing the number of fields.
  • Nested Fields: Consider using nested fields or objects to reduce the total number of top-level fields.

2. Increase Payload Size Limit:

  • Cluster Settings: Adjust the settings of your OpenSearch cluster to allow larger payloads if possible. You might need to update the http.max_content_length setting.

Example:

PUT _cluster/settings
{
  "persistent": {
    "http.max_content_length": "100mb"
  }
}

Note: Be cautious with this approach as increasing the limit might have performance implications.

3. Pagination or Splitting Requests:

  • Paginate the Field Requests: If creating the index pattern requires multiple API calls, try to split the requests into smaller batches.
  • Create in Chunks: If possible, create the index pattern in smaller chunks and then merge them.

4. Optimize Field Data:

  • Field Mapping: Optimize the field mappings to exclude unnecessary fields from being indexed. Use the enabled parameter to disable indexing for certain fields.

5. Use Templates:

  • Index Templates: Use index templates to manage and apply settings and mappings across multiple indices. This can help in standardizing the fields and reducing the payload size when creating index patterns.

6. Check OpenSearch Configuration: Ensure that the OpenSearch service is correctly configured to handle large payloads. Sometimes, the service might have limitations based on instance types and configurations. Example Adjustments Here's an example of how you can reduce the number of fields and optimize mappings:

PUT /your_index/_mapping
{
  "properties": {
    "field1": {
      "type": "text"
    },
    "field2": {
      "type": "keyword"
    },
    "nested_field": {
      "type": "nested",
      "properties": {
        "subfield1": {
          "type": "text"
        },
        "subfield2": {
          "type": "keyword"
        }
      }
    }
  }
}

Conclusion

To resolve the "Request Entity Too Large" error when creating an index pattern in AWS OpenSearch, you can:

  • Reduce the number of fields.
  • Increase the payload size limit in the cluster settings.
  • Paginate or split your requests.
  • Optimize field data and mappings.
  • Use index templates.

By implementing these strategies, you should be able to create your index pattern successfully without hitting the payload size limit.

EXPERT
answered 2 years ago
0

Hello,

From the Elastic search documentation: http.max_content_length

Maximum size of an HTTP request body. Defaults to 100mb. Configuring this setting to greater than 100mb can cause cluster instability and is not recommended. If you hit this limit when sending a request to the Bulk API, configure your client to send fewer documents in each bulk request. If you wish to index individual documents that exceed 100mb, pre-process them into smaller documents before sending them to Elasticsearch. For instance, store the raw data in a system outside Elasticsearch and include a link to the raw data in the documents that Elasticsearch indexes.

EXPERT
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.