# Error indexing with httpjson

**URL:** <https://discuss.elastic.co/t/error-indexing-with-httpjson/299122>\
**Category:** Elasticsearch\
**Created:** [March 8, 2022, 5:20pm UTC](https://discuss.elastic.co/t/error-indexing-with-httpjson/299122 "2022-03-08T17:20:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![humartinez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/humartinez/32/46395_2.png) [@humartinez](https://discuss.elastic.co/u/humartinez)\
**Post date:** [March 8, 2022, 5:20pm UTC](https://discuss.elastic.co/t/error-indexing-with-httpjson/299122/1 "2022-03-08T17:20:55Z")

</div>

Hi,  
Im having a issue while indexing via filebeat httpjson to elastic

I have this configuration

```auto
filebeat.inputs:
- type: httpjson
  enabled: true
  config_version: 2
  fields_under_root: true
  json.keys_under_root: true
  json.overwrite_keys: true
  json.add_error_key: true
  processors:
    - decode_json_fields:
        fields: ["message"]
  interval: 5m
  request.url: https://endpoint/slowQueries
  request.proxy_url: http://proxy:8080
  request.transforms:
    - set:
        target: header.api-key
        value: 'key'
output.elasticsearch:
  enabled: true
  hosts: ["elastic:9200"]
  index: "mongoatlas-%{+yyyy.MM.dd}"
  username: "elastic"
  password: "xxxxxx"
logging.level: info
logging.selectors: ["*"]
setup.template.name: "mongoatlas"
setup.template.pattern: "mongoatlas-*"

```

The result from the endpoint is a valid JSON

```auto
{
  "process": "atlas-k2w8aa-shard-00-02.l48fp.mongodb.net:27017",
  "queries": []
}

```

This is the error that Im getting at ES

2022-03-08T17:06:47.236Z WARN [Elasticsearch] Elasticsearch/client.go:405 Cannot index event publisher.Event{Content:beat.Event{Timestamp:time.Time{wall:0xc08201298c05b3cd, ext:2576639853, loc:(\*time.Location)(0x55f47600d320)}, Meta:null, Fields:{"agent":{"ephemeral\_id":"ab754087-f546-47df-b0bc-f4747179be3e","hostname":"filebeat-mongodb-7c8dc6b4bc-gpgkj","id":"af2be906-c358-4bad-ab25-e18208150fbe","name":"filebeat-mongodb-7c8dc6b4bc-gpgkj","type":"filebeat","version":"7.14.1"},"ecs":{"version":"1.10.0"},"event":{"created":"2022-03-08T17:06:46.201Z"},"host":{"name":"filebeat-mongodb-7c8dc6b4bc-gpgkj"},"input":{"type":"httpjson"},"message":{"process":"[atlas-k2w8aa-shard-00-02.l48fp.mongodb.net:27017](http://atlas-k2w8aa-shard-00-02.l48fp.mongodb.net:27017)","queries":}}, Private:interface {}(nil), TimeSeries:false}, Flags:0x1, Cache:publisher.EventCache{m:common.MapStr(nil)}} (status=400): {"type":"mapper\_parsing\_exception","reason":"failed to parse field [message] of type [text] in document with id '-qt\_an8BK1CtvcLQYWlD'. Preview of field's value: '{[process:27017=atlas-k2w8aa-shard-00-02.l48fp.mongodb.net](http://process:27017=atlas-k2w8aa-shard-00-02.l48fp.mongodb.net), queries=}'","caused\_by":{"type":"illegal\_state\_exception","reason":"Can't get text on a START\_OBJECT at 1:361"}}

Help would be appreciated

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 9, 2022, 9:56pm UTC](https://discuss.elastic.co/t/error-indexing-with-httpjson/299122/2 "2022-03-09T21:56:42Z")

</div>

[Can't get text on a START\_OBJECT](https://discuss.elastic.co/t/cant-get-text-on-a-start-object/244340) has some places to start on this.

---

<div class="post-metadata">

**Author:** ![humartinez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/humartinez/32/46395_2.png) [@humartinez](https://discuss.elastic.co/u/humartinez)\
**Post date:** [March 10, 2022, 1:59pm UTC](https://discuss.elastic.co/t/error-indexing-with-httpjson/299122/3 "2022-03-10T13:59:56Z")

</div>

Mark, the json is valid i can make the query to the remote endpoint and parse it with jq or any other json parser, filebeat has an issue reading It.  
And if I send the stream to logstash and It didn't complain about It.

---

<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:** [April 7, 2022, 2:00pm UTC](https://discuss.elastic.co/t/error-indexing-with-httpjson/299122/4 "2022-04-07T14:00:34Z")

</div>

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