# Field definition in logstash and elastic search

**URL:** https://discuss.elastic.co/t/field-definition-in-logstash-and-elastic-search/286144
**Category:** Elasticsearch
**Created:** [October 7, 2021, 2:11pm UTC](https://discuss.elastic.co/t/field-definition-in-logstash-and-elastic-search/286144 "2021-10-07T14:11:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mangeshs](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@mangeshs](https://discuss.elastic.co/u/mangeshs)
#### Post date: [October 7, 2021, 2:11pm UTC](https://discuss.elastic.co/t/field-definition-in-logstash-and-elastic-search/286144/1 "2021-10-07T14:11:38Z")

</div>

I have created three fields  
one index-number according to path and two static as mentioned in config file

```auto
grok {
		match => {"path" => "indexer-(?<index-number>[0-9]*)"}
	}
	mutate{
		convert => {"index-number" => "integer"}
		gsub => ["time_stamp", ",", ".","time_stamp", " ", "T"]
		replace => {"time_stamp" => "%{time_stamp}Z"}
	}
	if [type] == "indexer"{
		mutate{
			add_field => {
				application_s => "bcf"
				sub_application => "indexer"
			}
		}
	}

```

and mapping in Elasticsearch as follows

```auto
PUT /localtest3
{
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
    "properties": {
      "time_stamp": {
        "type": "date"
      },
	"log_level": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword"
          }
        }
      },
	"thread": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword"
          }
        }
      },
	"class": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword"
          }
        }
      },
	"msg": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword"
          }
        }
      }
      ,
	"index-number": {
        "type": "integer"
      },
"application_s": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword"
          }
        }
      },
"sub_application": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword"
          }
        }
      }
    }
  }
}

```

still at kibana search it is showing "?" before fields and cant apply filters to it

 ![kibana](https://us1.discourse-cdn.com/elastic/original/3X/5/4/541c4eccbef45f4d369fc32fbeb3266906dfa275.png)

---

<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 7, 2021, 2:32pm UTC](https://discuss.elastic.co/t/field-definition-in-logstash-and-elastic-search/286144/2 "2021-10-07T14:32:59Z")

</div>

You need to refresh the index pattern in Kibana.

Go to the Kibana Settings, Index Patterns and select the index pattern of your index, this will trigger a refresh of the 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 4, 2021, 2:33pm UTC](https://discuss.elastic.co/t/field-definition-in-logstash-and-elastic-search/286144/3 "2021-11-04T14:33:06Z")

</div>

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