# What is the appropriate document size in Elasticsearch？

**URL:** <https://discuss.elastic.co/t/what-is-the-appropriate-document-size-in-elasticsearch/358191>\
**Category:** Elasticsearch\
**Created:** [April 25, 2024, 9:15am UTC](https://discuss.elastic.co/t/what-is-the-appropriate-document-size-in-elasticsearch/358191 "2024-04-25T09:15:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiankunking](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jiankunking/32/39320_2.png) [@jiankunking](https://discuss.elastic.co/u/jiankunking)\
**Post date:** [April 25, 2024, 9:15am UTC](https://discuss.elastic.co/t/what-is-the-appropriate-document-size-in-elasticsearch/358191/1 "2024-04-25T09:15:34Z")

</div>

```auto
// Reduced irrelevant attributes
{
        "code": "product code",  
        "saleIncludeCustomers": [ // Object
                {
                        "code": "Customer code",
                        "launchId": "launchId"
                }
        ],
        "saleByLaunchRule": [ // nested  
                {
                        "center": "center",
                        "channel": "channel",
                        "subChannel": "subChannel",
                        "launchId": "launchId",
                        "endDate": 1777478400000
                }
        ],
        "saleExcludeCustomers": [ // Blacklist 
               "Customer code"
        ],
        "centerIncludeCustomers": { 
                "center1": [
                                {
                                        "code": "Customer code",
                                        "launchId": "launchId"
                                }
                            ],
                "center2": [
                                {
                                        "code": "Customer code",
                                        "launchId": "launchId"
                                }
                        ]
        } 
}

```

In my scenario, there may be a lot of data for salesInclusieCustomers, centerInclusieCustomers, and salesByLaunchRule, such as thousands。

> The fields salesInclusieCustomers, centerInclusieCustomers, and salesByLaunchRule are mainly used to filter data and do not need to be returned during queries

I will generate test data according to the following

- SaleIncludeCustomers Fill 200
- Fill 1000 salesExcludeCustomers
- CenterInclusieCustomers fill 42 centers, with 620 customer objects filled in each center
- Each customer object has two attributes, one is the customer ID and the other is the advertising rule ID
  - 620 \* 42=26000, which meets the total number of customers

- SaleByLaunchRule Fill 500

At this point, the document size is about 530kb, but I have verified the query and it is still very fast. **I would like to ask what is the appropriate document size in ES?**

> Note: This index is the product index, so according to the product dimension, the number of documents will not be very large, currently around 30000

Index Details

```auto
GET /_cat/indices/jiankunking_product_test_v2?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open jiankunking_product_test_v2 8HzUbdbHTdiyOJ3Ym8OnaA 12 1 15134264 0 30.5gb 15.2gb

```

```auto
GET /jiankunking_product_test_v2/_search?track_total_hits=true
{
  "size": 0
}

{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 12,
    "successful" : 12,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 30088,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : []
  }
}

```

---

<div class="post-metadata">

**Author:** ![jiankunking](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jiankunking/32/39320_2.png) [@jiankunking](https://discuss.elastic.co/u/jiankunking)\
**Post date:** [January 15, 2025, 8:15am UTC](https://discuss.elastic.co/t/what-is-the-appropriate-document-size-in-elasticsearch/358191/2 "2025-01-15T08:15:26Z")

</div>

Found a solution  
[https://jiankunking.com/how-to-optimize-elasticsearch-large-document-query.html](https://jiankunking.com/how-to-optimize-elasticsearch-large-document-query.html)
