# Bulk API - can't add more than one row

**URL:** https://discuss.elastic.co/t/bulk-api-cant-add-more-than-one-row/295718
**Category:** Elasticsearch
**Created:** [January 28, 2022, 3:35pm UTC](https://discuss.elastic.co/t/bulk-api-cant-add-more-than-one-row/295718 "2022-01-28T15:35:29Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![yamaga](https://avatars.discourse-cdn.com/v4/letter/y/858c86/32.png) [@yamaga](https://discuss.elastic.co/u/yamaga)
#### Post date: [January 28, 2022, 3:35pm UTC](https://discuss.elastic.co/t/bulk-api-cant-add-more-than-one-row/295718/1 "2022-01-28T15:35:29Z")

</div>

Hi

I am trying to add some data with Bulk API, but it takes only the last record of my JSON input data.

Here an example with 3 record:

input data:

```auto
[
  {
    "ID_PROD": "15136",
    "UNIT": "UN",
    "RATE": 1
  },
  {
    "ID_PROD": "21588",
    "UNIT": "UN",
    "RATE": 1
  },
  {
    "ID_PROD": "21500",
    "UNIT": "UN",
    "RATE": 2
  }
]

```

It takes only the last record  
Screen from Kibana index management  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/7/47e64113f415c8bc0bda931e7931bbc4ff3d4801.png)

Any idea about the cause of that issue?

Thanks in advance

---

<div class="post-metadata">

### Author: ![HenningAndersen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henningandersen/32/48188_2.png) [@HenningAndersen](https://discuss.elastic.co/u/HenningAndersen)
#### Post date: [January 28, 2022, 9:24pm UTC](https://discuss.elastic.co/t/bulk-api-cant-add-more-than-one-row/295718/2 "2022-01-28T21:24:55Z")

</div>

Hi @yamaga ,

the [REST bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/7.16/docs-bulk.html) expects ndjson. Are you using the REST API or one of the clients?

---

<div class="post-metadata">

### Author: ![yamaga](https://avatars.discourse-cdn.com/v4/letter/y/858c86/32.png) [@yamaga](https://discuss.elastic.co/u/yamaga)
#### Post date: [January 31, 2022, 11:46am UTC](https://discuss.elastic.co/t/bulk-api-cant-add-more-than-one-row/295718/3 "2022-01-31T11:46:44Z")

</div>

I am using an external API  
it works when I add a key to every record.

---

<div class="post-metadata">

### Author: ![HenningAndersen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henningandersen/32/48188_2.png) [@HenningAndersen](https://discuss.elastic.co/u/HenningAndersen)
#### Post date: [January 31, 2022, 12:34pm UTC](https://discuss.elastic.co/t/bulk-api-cant-add-more-than-one-row/295718/4 "2022-01-31T12:34:35Z")

</div>

Hi @yamaga,

which API is that? I am not sure I understand what you mean by "external API", can you elaborate please?

> it works when I add a key to every record

How does the resulting payload look? And is there still a need for help on this?

---

<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: [February 28, 2022, 12:35pm UTC](https://discuss.elastic.co/t/bulk-api-cant-add-more-than-one-row/295718/5 "2022-02-28T12:35:09Z")

</div>

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