# Issue when trying to post Json from Attribute

**URL:** <https://discuss.elastic.co/t/issue-when-trying-to-post-json-from-attribute/91274>\
**Category:** Elasticsearch\
**Created:** [June 29, 2017, 11:35am UTC](https://discuss.elastic.co/t/issue-when-trying-to-post-json-from-attribute/91274 "2017-06-29T11:35:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Bullock](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthew_bullock/32/47550_2.png) [@Matthew\_Bullock](https://discuss.elastic.co/u/Matthew_Bullock)\
**Post date:** [June 29, 2017, 11:35am UTC](https://discuss.elastic.co/t/issue-when-trying-to-post-json-from-attribute/91274/1 "2017-06-29T11:35:27Z")

</div>

I am trying to run a for loop on a json logs

```
#!/bin/bash
while read LINE; do
  ID=(`echo $LINE | JQ -r .rayId`)
  echo $ID
  echo curl -g -XPUT "http://localhost:9200/elsv2/logs/$ID?pipeline=geoip-elsv2" -H 'Content-Type:application/json' --data-binary "'"$LINE"'"
  curl -g -XPUT "http://localhost:9200/elsv2/logs/$ID?pipeline=geoip-elsv2" -H 'Content-Type:application/json' --data-binary "'"$LINE"'"
done < LOGPULL

```

The issue is I get:

> {"error":{"root\_cause":[{"type":"not\_x\_content\_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"}],"type":"not\_x\_content\_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"},"status":500}

Now in my loop i echo the line out:

> curl -g -XPUT [http://localhost:9200/elsv2/logs/37602b9101b872d1?pipeline=geoip-elsv2](http://localhost:9200/elsv2/logs/37602b9101b872d1?pipeline=geoip-elsv2) -H Content-Type:application/json --data-binary @{"brandId":100,"flags":2,"hosterId":0,"ownerId":5531537,"rayId":"37602b9101b872d1","securityLevel":"med","timestamp":1498647918244999936,"unstablePublic":null,"zoneId":xxxxx,"zoneName":"xxxxx.one","zonePlan":"enterprise","client":{"asNum":60781,"country":"us","deviceType":"desktop","ip":"xxxxx","ipClass":"noRecord","srcPort":35408,"sslCipher":"NONE","sslFlags":0,"sslProtocol":"none"},"clientRequest":{"accept":"","body":null,"bodyBytes":0,"bytes":38,"cookies":null,"flags":0,"headers":,"httpHost":"xxxxx.one","httpMethod":"GET","httpProtocol":"HTTP/1.1","referer":"","uri":"/","userAgent":""},"edge":{"bbResult":"0","cacheResponseTime":0,"colo":20,"enabledFlags":106,"endTimestamp":1498647918249999872,"flServerIp":"104.16.85.188","flServerName":"20f164","flServerPort":80,"pathingOp":"wl","pathingSrc":"macro","pathingStatus":"nr","startTimestamp":1498647918244999936,"usedFlags":32,"rateLimit":{"ruleId":0,"mitigationId":null,"sourceId":"","processedRules":[{"ruleId":75132,"ruleSrc":"user","status":"allow","ruleType":"ban"}]},"dnsResponse":{"rcode":0,"error":"ok","cached":false,"duration":0,"errorMsg":"","overrideError":false}},"edgeResponse":{"bodyBytes":5,"bytes":322,"compressionRatio":0,"contentType":"","headers":null,"setCookies":null,"status":301}}

If i copy and paste this line direct then it works. is there something wrong in my formatting of the curl when i declare the attribute that holds the JSON?

---

<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 27, 2017, 11:35am UTC](https://discuss.elastic.co/t/issue-when-trying-to-post-json-from-attribute/91274/2 "2017-07-27T11:35:41Z")

</div>

Closed on July 27, 2017, 11:35am UTC

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