# Compressor detection can only be called on some xcontent bytes

**URL:** <https://discuss.elastic.co/t/compressor-detection-can-only-be-called-on-some-xcontent-bytes/184959>\
**Category:** Elasticsearch\
**Created:** [June 10, 2019, 9:54am UTC](https://discuss.elastic.co/t/compressor-detection-can-only-be-called-on-some-xcontent-bytes/184959 "2019-06-10T09:54:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hiven](https://avatars.discourse-cdn.com/v4/letter/h/ac91a4/32.png) [@Hiven](https://discuss.elastic.co/u/Hiven)\
**Post date:** [June 10, 2019, 9:54am UTC](https://discuss.elastic.co/t/compressor-detection-can-only-be-called-on-some-xcontent-bytes/184959/1 "2019-06-10T09:54:51Z")

</div>

I'm trying to send data to elasticsearch but running into the error:

```
Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes

```

Here is my data:

```
[ {
  "data" : "119050300",
  "date" : "00:00 2019-06-03"
}, {
  "data" : "119050301",
  "date" : "01:00 2019-06-03"
}, {
  "data" : "119050302",
  "date" : "02:00 2019-06-03"
}, {
  "data" : "119050303",
  "date" : "03:00 2019-06-03"
}, {
  "data" : "119050304",
  "date" : "04:00 2019-06-03"
}, {
  "data" : "119050305",
  "date" : "05:00 2019-06-03"
}, {
  "data" : "119050306",
  "date" : "06:00 2019-06-03"
}, {
  "data" : "119050307",
  "date" : "07:00 2019-06-03"
}, {
  "data" : "119050308",
  "date" : "08:00 2019-06-03"
}, {
  "data" : "119050309",
  "date" : "09:00 2019-06-03"
}, {
  "data" : "119050310",
  "date" : "10:00 2019-06-03"
}, {
  "data" : "119050311",
  "date" : "11:00 2019-06-03"
}, {
  "data" : "119050312",
  "date" : "12:00 2019-06-03"
}, {
  "data" : "119050313",
  "date" : "13:00 2019-06-03"
}, {
  "data" : "119050314",
  "date" : "14:00 2019-06-03"
}, {
  "data" : "119050315",
  "date" : "15:00 2019-06-03"
}, {
  "data" : "119050923",
  "date" : "23:00 2019-06-09"
} ]

```

Im using a PUT command with this in the body and hitting URL:

```
 http://....com:5101/core/doc/1
```

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [June 10, 2019, 1:00pm UTC](https://discuss.elastic.co/t/compressor-detection-can-only-be-called-on-some-xcontent-bytes/184959/2 "2019-06-10T13:00:22Z")

</div>

You seem to be trying to send a bare JSON **array** to Elasticsearch, but Elasticsearch expects to receive JSON **objects** instead. If you want this to be indexed as a single document, you should wrap it in an object:

```nohighlight
{"values":[{"data":"119050300","date":"00:00 2019-06-03"},...

```

If you want each object in your array to be a separate document, you are probably looking for the [bulk indexing API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html) instead.

---

<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:** [July 8, 2019, 1:00pm UTC](https://discuss.elastic.co/t/compressor-detection-can-only-be-called-on-some-xcontent-bytes/184959/3 "2019-07-08T13:00:26Z")

</div>

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