# Failed to parse field \[document.error\] of type \[text\] in document

**URL:** <https://discuss.elastic.co/t/failed-to-parse-field-document-error-of-type-text-in-document/344108>\
**Category:** Logstash\
**Created:** [September 29, 2023, 7:49am UTC](https://discuss.elastic.co/t/failed-to-parse-field-document-error-of-type-text-in-document/344108 "2023-09-29T07:49:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keremcan\_Seker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/keremcan_seker/32/126097_2.png) [@Keremcan\_Seker](https://discuss.elastic.co/u/Keremcan_Seker)\
**Post date:** [September 29, 2023, 7:49am UTC](https://discuss.elastic.co/t/failed-to-parse-field-document-error-of-type-text-in-document/344108/1 "2023-09-29T07:49:09Z")

</div>

I'm sending data to logstash through kafka python client. this is the object i send  
`{"user_id":"kafka12","service_name":"kafka12","activity_type":"kafka","error":{"message":"Invalid username","component_id":"Y456"},"additional_data":{"key":"build"}}`

and on the logstash log i get this warn  
]`could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"user_activity_log_missing_data", :routing=>nil}, {"@timestamp"=>2023-09-29T07:38:38.823781508Z, "document"=>{"additional_data"=>{"key"=>"build"}, "user_id"=>"kafka12", "service_name"=>"kafka12", "activity_type"=>"kafka", "error"=>{"component_id"=>"Y456", "message"=>"Invalid username"}}}], :response=>{"index"=>{"_index"=>"user_activity_log_missing_data", "_id"=>"alrg34oBFJ5BviDnE3nj", "status"=>400, "error"=>{"type"=>"document_parsing_exception", "reason"=>"[1:222] failed to parse field [document.error] of type [text] in document with id 'alrg34oBFJ5BviDnE3nj'. Preview of field's value: '{component_id=Y456, message=Invalid username}'", "caused_by"=>{"type"=>"illegal_state_exception", "reason"=>"Can't get text on a START_OBJECT at 1:171"}}}}}`

this warn does not occur when i send the same data with http request

---

<div class="post-metadata">

**Author:** ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)\
**Post date:** [September 29, 2023, 7:56am UTC](https://discuss.elastic.co/t/failed-to-parse-field-document-error-of-type-text-in-document/344108/2 "2023-09-29T07:56:10Z")

</div>

Check a similar [issue](https://discuss.elastic.co/t/logstash-failed-to-parse-field-host-of-type-text-in-document/342697/2).

---

<div class="post-metadata">

**Author:** ![Keremcan\_Seker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/keremcan_seker/32/126097_2.png) [@Keremcan\_Seker](https://discuss.elastic.co/u/Keremcan_Seker)\
**Post date:** [September 29, 2023, 7:57am UTC](https://discuss.elastic.co/t/failed-to-parse-field-document-error-of-type-text-in-document/344108/3 "2023-09-29T07:57:38Z")

</div>

if that is the case than why there is no problem with http requests?

---

<div class="post-metadata">

**Author:** ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)\
**Post date:** [September 29, 2023, 8:56am UTC](https://discuss.elastic.co/t/failed-to-parse-field-document-error-of-type-text-in-document/344108/4 "2023-09-29T08:56:11Z")

</div>

I don't think so. This is in your LS log.

> "error"=\>{"type"=\>" **document\_parsing\_exception**", "reason"=\>"[1:222] failed to parse field [document.error] of type [text] in document with id 'alrg34oBFJ5BviDnE3nj'. Preview of field's value: '{component\_id=Y456, message=Invalid username}'", "caused\_by"=\>{"type"=\>"illegal\_state\_exception", "reason"=\>"Can't get text on a START\_OBJECT at 1:171"}}}}}

---

<div class="post-metadata">

**Author:** ![Keremcan\_Seker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/keremcan_seker/32/126097_2.png) [@Keremcan\_Seker](https://discuss.elastic.co/u/Keremcan_Seker)\
**Post date:** [September 29, 2023, 10:09am UTC](https://discuss.elastic.co/t/failed-to-parse-field-document-error-of-type-text-in-document/344108/5 "2023-09-29T10:09:40Z")

</div>

![image](https://us1.discourse-cdn.com/elastic/original/3X/1/3/13380a359f03e33021e5ac913746ce39c22e6d3c.png)  
i don't know where that "cmponent\_id" came from but the rest looking good what do you think

---

<div class="post-metadata">

**Author:** ![Keremcan\_Seker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/keremcan_seker/32/126097_2.png) [@Keremcan\_Seker](https://discuss.elastic.co/u/Keremcan_Seker)\
**Post date:** [September 29, 2023, 12:19pm UTC](https://discuss.elastic.co/t/failed-to-parse-field-document-error-of-type-text-in-document/344108/6 "2023-09-29T12:19:35Z")

</div>

okey i have fixed with the problem with deleting and recreating all of them thanks

---

<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:** [October 27, 2023, 12:20pm UTC](https://discuss.elastic.co/t/failed-to-parse-field-document-error-of-type-text-in-document/344108/7 "2023-10-27T12:20:10Z")

</div>

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