# Creating searchable and aggregatable mappings for a new index

**URL:** <https://discuss.elastic.co/t/creating-searchable-and-aggregatable-mappings-for-a-new-index/74508>\
**Category:** Elasticsearch\
**Created:** [February 9, 2017, 1:39pm UTC](https://discuss.elastic.co/t/creating-searchable-and-aggregatable-mappings-for-a-new-index/74508 "2017-02-09T13:39:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![leigh](https://avatars.discourse-cdn.com/v4/letter/l/71e660/32.png) [@leigh](https://discuss.elastic.co/u/leigh)\
**Post date:** [February 9, 2017, 1:39pm UTC](https://discuss.elastic.co/t/creating-searchable-and-aggregatable-mappings-for-a-new-index/74508/1 "2017-02-09T13:39:09Z")

</div>

I am trying to create a new index and also specify the mappings before sending any data to ES. Taking a simple example:

{  
"mappings": {  
"monitor": {  
"properties": {  
"MAX": {  
"type": "float",  
"fields": {  
"keyword": {  
"ignore\_above": 256,  
"type": "keyword"  
}  
}  
},  
"GUID": {  
"type": "text",  
"fields": {  
"keyword": {  
"ignore\_above": 256,  
"type": "keyword"  
}  
}  
},  
"STAMP": {  
"format": "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch\_millis",  
"type": "date"  
}  
}  
}  
}  
}

I would like for both the MAX and the GUID field to be searchable and aggregatable. The goal is to be able to create a graph using the MAX field (a float type) and then filter based on the GUID (a text type which represents a server). I PUT the above json in a call to the ES cluster:

PUT my\_ES:9200/theindex

I have tried various combinations and am unable for Kibana to recognise these fields as searchable or aggregatable. If i post a sample document to an index which doesn't exist yet, the new index contains searchable and aggregatable text fields (dynamic mapping) eg)

PUT my\_ES:9200/theindex  
{  
"GUID": "0c26d3d9-c81b-4323-a4a4-cc3a884f55a2",  
"MAX": "10",  
"STAMP": "2016/12/05 14:47:45"  
}

results in 2 GUID fields: GUID and GUID.keyword (the latter is searchable and aggregatable). I don't want the type to be TEXT for the equivalent MAX fields though.

Any help appreciated

---

<div class="post-metadata">

**Author:** ![leigh](https://avatars.discourse-cdn.com/v4/letter/l/71e660/32.png) [@leigh](https://discuss.elastic.co/u/leigh)\
**Post date:** [February 10, 2017, 3:04pm UTC](https://discuss.elastic.co/t/creating-searchable-and-aggregatable-mappings-for-a-new-index/74508/2 "2017-02-10T15:04:51Z")

</div>

Resolution: for text fields needed to be "keyword" type and, importantly, you need to have some data in the index before fields are registered as aggregatable and searchable.

---

<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:** [March 10, 2017, 3:05pm UTC](https://discuss.elastic.co/t/creating-searchable-and-aggregatable-mappings-for-a-new-index/74508/3 "2017-03-10T15:05:06Z")

</div>

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