# Existing mapping for \[postfix\] must be of type object but found \[boolean\]

**URL:** https://discuss.elastic.co/t/existing-mapping-for-postfix-must-be-of-type-object-but-found-boolean/203479
**Category:** Вопросы на русском языке
**Created:** [October 14, 2019, 2:52pm UTC](https://discuss.elastic.co/t/existing-mapping-for-postfix-must-be-of-type-object-but-found-boolean/203479 "2019-10-14T14:52:06Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![beren](https://avatars.discourse-cdn.com/v4/letter/b/87869e/32.png) [@beren](https://discuss.elastic.co/u/beren)
#### Post date: [October 14, 2019, 2:52pm UTC](https://discuss.elastic.co/t/existing-mapping-for-postfix-must-be-of-type-object-but-found-boolean/203479/1 "2019-10-14T14:52:07Z")

</div>

Всем привет.

Поднял с нуля ELK.  
Настроил его на мониторинг  
В /etc/logstash/conf.d/postfix.conf

> **[Пост #127900 | Pastebin Calculate Linux](http://pastebin.calculate-linux.ru/ru/show/127900)**
>
> Сервис для размещения блоков кода

В /etc/logstash/patterns/postfix

> **[Пост #127901 | Pastebin Calculate Linux](http://pastebin.calculate-linux.ru/ru/show/127901)**
>
> Сервис для размещения блоков кода

Но в логах logstash

> Blockquote

[2019-10-14T10:39:13,494][WARN][logstash.outputs.elasticsearch][main] Could not index event to Elasticsearch. {:status=\>400, :action=\>["index", {:\_id=\>nil, :\_index=\>"postfix10-2019.10.14", :\_type=\>"\_doc", :routing=\>nil}, #LogStash::Event:0x65c32d89], :response=\>{"index"=\>{"\_index"=\>"postfix10-2019.10.14", "\_type"=\>"\_doc", "\_id"=\>"MBm1ym0Br-QV79CHeMxH", "status"=\>400, "error"=\>{"type"=\>"mapper\_parsing\_exception", "reason"=\>"Could not dynamically add mapping for field [postfix.client\_ip]. Existing mapping for [postfix] must be of type object but found [boolean]."}}}}

Как починить это ?

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [October 14, 2019, 3:56pm UTC](https://discuss.elastic.co/t/existing-mapping-for-postfix-must-be-of-type-object-but-found-boolean/203479/2 "2019-10-14T15:56:19Z")

</div>

Эта ошибка означает, что когда у вас была добавлена запись, которая выглядела как-то так:

```auto
{
...
  "postfix": false
...
}

```

или тоже самое с `true`. В результате, elasticsearch ждет что в этом поле прибудет boolean, а прибывает объект. Надо удалить индекс и начать заново, убедившись, что посылаются данные правильного формата ю

---

<div class="post-metadata">

### Author: ![beren](https://avatars.discourse-cdn.com/v4/letter/b/87869e/32.png) [@beren](https://discuss.elastic.co/u/beren)
#### Post date: [October 15, 2019, 6:40am UTC](https://discuss.elastic.co/t/existing-mapping-for-postfix-must-be-of-type-object-but-found-boolean/203479/3 "2019-10-15T06:40:45Z")

</div>

Спасибо.

У меня в filebeat так:

```auto
filebeat.inputs:
- type: log
  enabled: true
  paths:
      - /var/log/maillog*
  exclude_files: [".gz$"]
  fields:
    postfix: true
  fields_under_root: true
output.logstash:
  hosts: ["192.168.199.147:5044"]

  elasticsearch:
    hosts: ["http://192.168.199.147:9200"]

```

Убрав

```auto
 fields:
    postfix: true
  fields_under_root: true

```

Всё заработало. Объясните, пожалуйста, что они делают ?

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [October 15, 2019, 7:01am UTC](https://discuss.elastic.co/t/existing-mapping-for-postfix-must-be-of-type-object-but-found-boolean/203479/4 "2019-10-15T07:01:43Z")

</div>

Вместо `blockquote` лучше использовать `````. Я поправил ваш пост для примера.

> [@beren](#):
>
> Объясните, пожалуйста, что они делают ?

> **[Log input | Filebeat Reference \[8.11\] | Elastic](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-input-log.html#filebeat-input-log-fields)**

---

<div class="post-metadata">

### Author: ![beren](https://avatars.discourse-cdn.com/v4/letter/b/87869e/32.png) [@beren](https://discuss.elastic.co/u/beren)
#### Post date: [October 15, 2019, 7:12am UTC](https://discuss.elastic.co/t/existing-mapping-for-postfix-must-be-of-type-object-but-found-boolean/203479/5 "2019-10-15T07:12:52Z")

</div>

Спасибо. Но после прочтения осознание не пришло.

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [October 15, 2019, 7:26am UTC](https://discuss.elastic.co/t/existing-mapping-for-postfix-must-be-of-type-object-but-found-boolean/203479/6 "2019-10-15T07:26:14Z")

</div>

`fields` добавляет эти поля в каждый документ. Если `fields_under_root` поставлен в `true` то перечисленные поля в `fields` появятся на самом верхнем уровне документа, если в `false`, то в поле `fields`. Но, в принципе, если вам никаких дополнительных статических полей добавлять в каждую запись не надо, то можно эти параметры смело убрать, и пока о них забыть.

---

<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: [November 12, 2019, 7:26am UTC](https://discuss.elastic.co/t/existing-mapping-for-postfix-must-be-of-type-object-but-found-boolean/203479/7 "2019-11-12T07:26:14Z")

</div>

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