# "reason"=\>"failed to parse field \[host.name\] of type \[text\] in document with id

**URL:** <https://discuss.elastic.co/t/reason-failed-to-parse-field-host-name-of-type-text-in-document-with-id/270923>\
**Category:** Logstash\
**Created:** [April 22, 2021, 6:19am UTC](https://discuss.elastic.co/t/reason-failed-to-parse-field-host-name-of-type-text-in-document-with-id/270923 "2021-04-22T06:19:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlackCat](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@BlackCat](https://discuss.elastic.co/u/BlackCat)\
**Post date:** [April 22, 2021, 6:19am UTC](https://discuss.elastic.co/t/reason-failed-to-parse-field-host-name-of-type-text-in-document-with-id/270923/1 "2021-04-22T06:19:10Z")

</div>

Logstash outputs below error log.

```auto
[2021-04-22T15:00:43,643][WARN][logstash.outputs.elasticsearch][＜pipeline id＞] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"＜index name＞", :routing=>nil, :_type=>"_doc"}, #<LogStash::Event:xxxxxxxx>], :response=>{"index"=>{"_index"=>"＜index name＞", "_type"=>"_doc", "_id"=>"xxxxxxxxxxxxxx", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [host.name] of type [text] in document with id 'xxxxxxxxxxxxxxx'.

```

I using below config of logstash.

```auto
input {
   beats {
     port => ＜port number＞
   }
}

filter {
 if "＜server ip＞" in [host][ip] {
      mutate {
       rename => { "message" => "Message" }
       add_field => { "Host" => "＜I using hope hostname.＞" }
      }
 }
}

filter {
    mutate {
        rename => ["[host]", "[host][name]" ]
    }
}

```

Data flow is below.  
Filebeat → Logstash → Elasticsearch

Version is all 7.12.

Please how to do resolve.

---

<div class="post-metadata">

**Author:** ![grumo35](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/grumo35/32/59451_2.png) [@grumo35](https://discuss.elastic.co/u/grumo35)\
**Post date:** [April 22, 2021, 7:55am UTC](https://discuss.elastic.co/t/reason-failed-to-parse-field-host-name-of-type-text-in-document-with-id/270923/2 "2021-04-22T07:55:47Z")

</div>

Hey,  
try this :

```auto
mutate{
				add_field => { "[host][name]" => "%{[host]}" }
}

```

---

<div class="post-metadata">

**Author:** ![BlackCat](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@BlackCat](https://discuss.elastic.co/u/BlackCat)\
**Post date:** [April 22, 2021, 10:18am UTC](https://discuss.elastic.co/t/reason-failed-to-parse-field-host-name-of-type-text-in-document-with-id/270923/3 "2021-04-22T10:18:04Z")

</div>

Do you say mean below?

```auto
filter {
    mutate {
        rename => ["[host]", "[host][name]" ]
    }
    mutate{
				add_field => { "[host][name]" => "%{[host]}" }
}
}

```

---

<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:** [May 20, 2021, 10:18am UTC](https://discuss.elastic.co/t/reason-failed-to-parse-field-host-name-of-type-text-in-document-with-id/270923/4 "2021-05-20T10:18:12Z")

</div>

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