# Waht are the possible datatypes of fileds of an index like keyword, ip , date nanos etc

**URL:** <https://discuss.elastic.co/t/waht-are-the-possible-datatypes-of-fileds-of-an-index-like-keyword-ip-date-nanos-etc/287891>\
**Category:** Elasticsearch\
**Created:** [October 28, 2021, 8:03am UTC](https://discuss.elastic.co/t/waht-are-the-possible-datatypes-of-fileds-of-an-index-like-keyword-ip-date-nanos-etc/287891 "2021-10-28T08:03:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![shi](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@shi](https://discuss.elastic.co/u/shi)\
**Post date:** [October 28, 2021, 8:03am UTC](https://discuss.elastic.co/t/waht-are-the-possible-datatypes-of-fileds-of-an-index-like-keyword-ip-date-nanos-etc/287891/1 "2021-10-28T08:03:59Z")

</div>

Waht are the possible datatypes of fileds of an index like keyword, ip , date nanos, etc?

guess if field type is keyword then it is is stored in docvalues so we can sort on it?  
regards  
shini

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 28, 2021, 8:34am UTC](https://discuss.elastic.co/t/waht-are-the-possible-datatypes-of-fileds-of-an-index-like-keyword-ip-date-nanos-etc/287891/2 "2021-10-28T08:34:38Z")

</div>

Are you looking for this?

> **[Field data types | Elasticsearch Guide \[7.15\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html)**

---

<div class="post-metadata">

**Author:** ![shi](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@shi](https://discuss.elastic.co/u/shi)\
**Post date:** [October 30, 2021, 10:42am UTC](https://discuss.elastic.co/t/waht-are-the-possible-datatypes-of-fileds-of-an-index-like-keyword-ip-date-nanos-etc/287891/3 "2021-10-30T10:42:37Z")

</div>

yes sir,

in the below mapping for "ip":"172.17.18.19"  
what does `"type" : "text"` indicates?  
(This definition comes above the ` "fields" : {` section

```auto
            "ip" : {
              "type" : "text",`
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256

```

thanks and regards  
shini

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [October 30, 2021, 3:02pm UTC](https://discuss.elastic.co/t/waht-are-the-possible-datatypes-of-fileds-of-an-index-like-keyword-ip-date-nanos-etc/287891/4 "2021-10-30T15:02:34Z")

</div>

If you don't create a mapping for your fields Elasticsearch will create the mapping the first time it index a field, when doing this it will try to guess what is the data type for that field based in its value.

Tha mapping you having means that Elasticsearch mapped that field as a string and when doing this it will map the field first as a `text` field and then map it also as a `keyword`, using the `fields` object to create a field with the suffix `.keyword`.

So, in your case you have a field named `ip` which is mapped a `text` field and a field named `ip.keyword` mapped as a `keyword` field.

---

<div class="post-metadata">

**Author:** ![shi](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@shi](https://discuss.elastic.co/u/shi)\
**Post date:** [October 30, 2021, 5:30pm UTC](https://discuss.elastic.co/t/waht-are-the-possible-datatypes-of-fileds-of-an-index-like-keyword-ip-date-nanos-etc/287891/5 "2021-10-30T17:30:51Z")

</div>

sir,  
So, does this means that finally the value of `ip` is stored as `keyword` type, itself?  
Because there is difference when the value is stored as `text` and when the value is stored as `keyword`, it will be helpful if we can know how it is finally stored.

As per the document,  
`you can index strings to both text and keyword fields. However, text field values are analyzed for full-text search while keyword strings are left as-is for filtering and sorting..`

thanks and regards  
shini

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 30, 2021, 6:36pm UTC](https://discuss.elastic.co/t/waht-are-the-possible-datatypes-of-fileds-of-an-index-like-keyword-ip-date-nanos-etc/287891/6 "2021-10-30T18:36:03Z")

</div>

`ip` is indexed as a `text`.  
`ip.keyword` is indexed as a `keyword`.

---

<div class="post-metadata">

**Author:** ![shi](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@shi](https://discuss.elastic.co/u/shi)\
**Post date:** [October 31, 2021, 5:37pm UTC](https://discuss.elastic.co/t/waht-are-the-possible-datatypes-of-fileds-of-an-index-like-keyword-ip-date-nanos-etc/287891/7 "2021-10-31T17:37:56Z")

</div>

ok sir...  
then it will be better to modify mappings to suite our needs after it gets created automatically, for efficient management of indexes.  
thanks and regards  
shiny  
.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [October 31, 2021, 10:53pm UTC](https://discuss.elastic.co/t/waht-are-the-possible-datatypes-of-fileds-of-an-index-like-keyword-ip-date-nanos-etc/287891/8 "2021-10-31T22:53:03Z")

</div>

Actually you want to create the index with the mapping _before_ you start indexing data / documents.

The most common way to do this is with an index template that contains the correct mapping.

---

<div class="post-metadata">

**Author:** ![shi](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@shi](https://discuss.elastic.co/u/shi)\
**Post date:** [November 1, 2021, 9:11am UTC](https://discuss.elastic.co/t/waht-are-the-possible-datatypes-of-fileds-of-an-index-like-keyword-ip-date-nanos-etc/287891/9 "2021-11-01T09:11:01Z")

</div>

i was uploading a sample from my log file using kibana iand generating the index and pipeline and then modifying them according to requirements to capture the actual log data from filebeat.  
thanks and regrads  
shini

---

<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 29, 2021, 9:11am UTC](https://discuss.elastic.co/t/waht-are-the-possible-datatypes-of-fileds-of-an-index-like-keyword-ip-date-nanos-etc/287891/10 "2021-11-29T09:11:20Z")

</div>

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