# Document Size Limit to 2kb while indexing document

**URL:** https://discuss.elastic.co/t/document-size-limit-to-2kb-while-indexing-document/128337
**Category:** Elasticsearch
**Created:** [April 17, 2018, 11:07am UTC](https://discuss.elastic.co/t/document-size-limit-to-2kb-while-indexing-document/128337 "2018-04-17T11:07:07Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Nitin\_Gupta2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nitin_gupta2/32/30078_2.png) [@Nitin\_Gupta2](https://discuss.elastic.co/u/Nitin_Gupta2)
#### Post date: [April 17, 2018, 11:07am UTC](https://discuss.elastic.co/t/document-size-limit-to-2kb-while-indexing-document/128337/1 "2018-04-17T11:07:07Z")

</div>

Hello team,  
I'm facing a serious issue while trying to index a document.  
I've simple java object "Country" which contains simple fields. Shown below;

```
    @JsonProperty("country")
private String countryName;

@JsonProperty("states")
private List<State> states;

@JsonProperty("population")
private List<PopulationYearModel> population;

```

And State object as;

```
@JsonProperty("state")
private final String stateName;

@JsonProperty("population")
private final List<PopulationYearModel> population;

```

And last PopulationYearModel as;

```
private int year;

private long population;

```

This is a very simple object.

Now when i'm trying to index a country object; as below;

```
IndexRequest request = client.prepareIndex().setIndex(indexName).setType(mapping.getIndexType())
			.setSource(datas, XContentType.JSON).request();

```

I'm getting an issues that ;  
index {[world\_population][population][null], source[n/a, a**ctual length: [4.8kb], max length: 2kb**]}

How to fix this... ?

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [April 17, 2018, 11:18am UTC](https://discuss.elastic.co/t/document-size-limit-to-2kb-while-indexing-document/128337/2 "2018-04-17T11:18:47Z")

</div>

Can you show what is a JSON document generated by your code?

---

<div class="post-metadata">

### Author: ![Nitin\_Gupta2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nitin_gupta2/32/30078_2.png) [@Nitin\_Gupta2](https://discuss.elastic.co/u/Nitin_Gupta2)
#### Post date: [April 17, 2018, 11:29am UTC](https://discuss.elastic.co/t/document-size-limit-to-2kb-while-indexing-document/128337/3 "2018-04-17T11:29:19Z")

</div>

@dadoonet: I'm converting object to Bytes rather in String.

---

<div class="post-metadata">

### Author: ![Nitin\_Gupta2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nitin_gupta2/32/30078_2.png) [@Nitin\_Gupta2](https://discuss.elastic.co/u/Nitin_Gupta2)
#### Post date: [April 17, 2018, 11:32am UTC](https://discuss.elastic.co/t/document-size-limit-to-2kb-while-indexing-document/128337/4 "2018-04-17T11:32:57Z")

</div>

I'm not able to paste it over here due to limit of this box..

its nearly 8000 character.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [April 17, 2018, 11:50am UTC](https://discuss.elastic.co/t/document-size-limit-to-2kb-while-indexing-document/128337/5 "2018-04-17T11:50:42Z")

</div>

Upload it to [gist.github.com](http://gist.github.com) and paste the link here.

---

<div class="post-metadata">

### Author: ![Nitin\_Gupta2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nitin_gupta2/32/30078_2.png) [@Nitin\_Gupta2](https://discuss.elastic.co/u/Nitin_Gupta2)
#### Post date: [April 17, 2018, 6:16pm UTC](https://discuss.elastic.co/t/document-size-limit-to-2kb-while-indexing-document/128337/6 "2018-04-17T18:16:34Z")

</div>

Please: here is the link: [https://gist.github.com/nits2010/7b2a25e3c941f983d244703f16d7a1ae](https://gist.github.com/nits2010/7b2a25e3c941f983d244703f16d7a1ae)  
Though if i use the same json using Kibana dev tools, with POST http method, this document got indexed.  
But not from the java code mentioned above.

---

<div class="post-metadata">

### Author: ![Nitin\_Gupta2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nitin_gupta2/32/30078_2.png) [@Nitin\_Gupta2](https://discuss.elastic.co/u/Nitin_Gupta2)
#### Post date: [April 18, 2018, 8:30am UTC](https://discuss.elastic.co/t/document-size-limit-to-2kb-while-indexing-document/128337/7 "2018-04-18T08:30:28Z")

</div>

Problem Resolved.  
It was due to bulk-processor. Since the setting of it are such that it never reaches to a threshold to execute the processor. Triggering the `bulkprocessor.flush()` does the job.

But I still don't understand, why it doesn't happen automatically, once the whole stream is completed.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [April 20, 2018, 2:14am UTC](https://discuss.elastic.co/t/document-size-limit-to-2kb-while-indexing-document/128337/8 "2018-04-20T02:14:21Z")

</div>

There was no mention of bulk in your initial question right?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [May 18, 2018, 2:14am UTC](https://discuss.elastic.co/t/document-size-limit-to-2kb-while-indexing-document/128337/9 "2018-05-18T02:14:27Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
