# Field "document\_type" sent via filebeat as "type" field to ES is ananlyzed

**URL:** <https://discuss.elastic.co/t/field-document-type-sent-via-filebeat-as-type-field-to-es-is-ananlyzed/100245>\
**Category:** Kibana\
**Created:** [September 12, 2017, 4:48pm UTC](https://discuss.elastic.co/t/field-document-type-sent-via-filebeat-as-type-field-to-es-is-ananlyzed/100245 "2017-09-12T16:48:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vijay.sangha](https://avatars.discourse-cdn.com/v4/letter/v/4491bb/32.png) [@vijay.sangha](https://discuss.elastic.co/u/vijay.sangha)\
**Post date:** [September 12, 2017, 4:48pm UTC](https://discuss.elastic.co/t/field-document-type-sent-via-filebeat-as-type-field-to-es-is-ananlyzed/100245/1 "2017-09-12T16:48:05Z")

</div>

I am using Filebeat 5.3--\>Logstash 5.3--\>Elasticserach 5.3.

While sending my documents using filebeat I am using document\_type to tag a log file type as below 👎

- input\_type: log  
paths:
  - /my/log/location/server.log  
document\_type: jboss-server-logs

This document\_type goes into elastic search as filed "type".

This filed "type" is searchable but analyzed. If I try to use the query in Kibana as "type : jboss-server-logs " it gives me all different logs files which have "jboss-server-logs", "jboss","logs" and each component broken.

I wanted to use this filed to particularly see at different log files I am pushing into one index.

How can i get rid of this filed being analyzed and make it a raw field?

---

<div class="post-metadata">

**Author:** ![timroes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timroes/32/19712_2.png) [@timroes](https://discuss.elastic.co/u/timroes)\
**Post date:** [September 12, 2017, 4:53pm UTC](https://discuss.elastic.co/t/field-document-type-sent-via-filebeat-as-type-field-to-es-is-ananlyzed/100245/2 "2017-09-12T16:53:09Z")

</div>

Hey,

if you haven't changed the default mapping, you could filter on `type.keyword:jboss-server-logs`, which will be the unanalyzed version. If that field doesn't exist, you would need to change the mapping, to store the `type` as a `keyword` (sub)field: [https://www.elastic.co/guide/en/elasticsearch/reference/5.3/keyword.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/keyword.html)

Cheers,  
Tim

---

<div class="post-metadata">

**Author:** ![vijay.sangha](https://avatars.discourse-cdn.com/v4/letter/v/4491bb/32.png) [@vijay.sangha](https://discuss.elastic.co/u/vijay.sangha)\
**Post date:** [September 12, 2017, 5:01pm UTC](https://discuss.elastic.co/t/field-document-type-sent-via-filebeat-as-type-field-to-es-is-ananlyzed/100245/3 "2017-09-12T17:01:49Z")

</div>

Hey Tim,

Thanks for responding,

I do have the filed type.keyword available associated with this field.

I do also see another filed named "\_type" which I can search on and that gives me intended results but as I need to transition the usage of Kibana to other teams, I wanted to keep it something simpler e.g. rather than using \_type or type.keyword, if they can use type: \<\> that would make pretty clean and easy.

Is there a way I can have retrieve this field un-analyzed in Elastic Search with the same name as type?

Thanks,  
VJ

---

<div class="post-metadata">

**Author:** ![timroes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timroes/32/19712_2.png) [@timroes](https://discuss.elastic.co/u/timroes)\
**Post date:** [September 12, 2017, 5:06pm UTC](https://discuss.elastic.co/t/field-document-type-sent-via-filebeat-as-type-field-to-es-is-ananlyzed/100245/4 "2017-09-12T17:06:33Z")

</div>

Hey VJ,

you can't use the same name to retrieve the field unanalyzed and analyzed in the same way.  
But you could change your mapping, so that the `type` field would be of type `keyword`, since I don't think you will ever need the analyzed version of this field, since you said they are just ids.

The `_type` field is actually something internal (thus the underscore) and you shouldn't use this. This might currently work, since apparently you use the `type` value also as an "ES document type", but that is already [deprecated](https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html) and will be removed in the upcoming versions.

That way you would only have a `type` field and it does what you want 🙂  
(If you still need the analyzed field, you could of course also think in renaming that to `type.analyzed` or similar.)

Cheers,  
Tim

---

<div class="post-metadata">

**Author:** ![vijay.sangha](https://avatars.discourse-cdn.com/v4/letter/v/4491bb/32.png) [@vijay.sangha](https://discuss.elastic.co/u/vijay.sangha)\
**Post date:** [September 12, 2017, 5:42pm UTC](https://discuss.elastic.co/t/field-document-type-sent-via-filebeat-as-type-field-to-es-is-ananlyzed/100245/5 "2017-09-12T17:42:04Z")

</div>

This mapping is something default which happens internally when the file beat specified field "document\_type" is retrieved by logastash and ES.

Is it possible for me to change that mapping?

---

<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 10, 2017, 5:42pm UTC](https://discuss.elastic.co/t/field-document-type-sent-via-filebeat-as-type-field-to-es-is-ananlyzed/100245/6 "2017-10-10T17:42:19Z")

</div>

Closed on October 10, 2017, 5:42pm UTC

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