# How can you set a custom analyzer on the "\_content" field of a mapper attachment during index creation?

**URL:** <https://discuss.elastic.co/t/how-can-you-set-a-custom-analyzer-on-the--content-field-of-a-mapper-attachment-during-index-creation/64777>\
**Category:** Elasticsearch\
**Created:** [November 2, 2016, 10:19pm UTC](https://discuss.elastic.co/t/how-can-you-set-a-custom-analyzer-on-the--content-field-of-a-mapper-attachment-during-index-creation/64777 "2016-11-02T22:19:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![totessusan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/totessusan/32/13028_2.png) [@totessusan](https://discuss.elastic.co/u/totessusan)\
**Post date:** [November 2, 2016, 10:19pm UTC](https://discuss.elastic.co/t/how-can-you-set-a-custom-analyzer-on-the--content-field-of-a-mapper-attachment-during-index-creation/64777/1 "2016-11-02T22:19:07Z")

</div>

I've tried doing this in my Attachment class (doesn't work):

```
[String(Name = "_content", TermVector = TermVectorOption.WithPositionsOffsets, Store = true, Analyzer = "autocomplete"]
public string Content { get; set; }

```

I want to be able to specify an edgeNGram analyzer for the "\_content" field so that I can perform autocomplete in my search for all mapper attachments. How can I achieve this?

My current index settings are as follows:  
{  
"html5-es" : {  
"aliases" : { },  
"mappings" : {  
"topic" : {  
"properties" : {  
"delete" : {  
"type" : "boolean"  
},  
"file" : {  
"type" : "attachment",  
"fields" : {  
"content" : {  
"type" : "string",  
"store" : true,  
"term\_vector" : "with\_positions\_offsets"  
},  
"author" : {  
"type" : "string",  
"store" : true,  
"term\_vector" : "with\_positions\_offsets"  
},  
"title" : {  
"type" : "string"  
},  
"name" : {  
"type" : "string"  
},  
"date" : {  
"type" : "date",  
"format" : "strict\_date\_optional\_time||epoch\_millis"  
},  
"keywords" : {  
"type" : "string"  
},  
"content\_type" : {  
"type" : "string"  
},  
"content\_length" : {  
"type" : "integer"  
},  
"language" : {  
"type" : "string"  
}  
}  
},  
"hash\_id" : {  
"type" : "string"  
},  
"path" : {  
"type" : "string"  
},  
"title" : {  
"type" : "string"  
}  
}  
}  
},  
"settings" : {  
"index" : {  
"creation\_date" : "1478123059878",  
"analysis" : {  
"filter" : {  
"standard" : {  
"type" : "standard"  
},  
"synonym" : {  
"format" : "solr",  
"ignore\_case" : "true",  
"expand" : "true",  
"type" : "synonym",  
"synonyms\_path" : "analysis/html5-es-Syn.txt"  
},  
"lowercase" : {  
"type" : "lowercase"  
},  
"stop" : {  
"ignore\_case" : "true",  
"type" : "stop",  
"stopwords\_path" : "stopwords/html5-es-Stop.txt"  
},  
"edgeNGram" : {  
"min\_gram" : "1",  
"side" : "front",  
"type" : "edge\_ngram",  
"max\_gram" : "25"  
},  
"asciifolding" : {  
"type" : "asciifolding",  
"preserveOriginal" : "true"  
},  
"shingle" : {  
"min\_shingle\_size" : "2",  
"type" : "shingle"  
},  
"snowball" : {  
"type" : "snowball",  
"language" : "English"  
}  
},  
"char\_filter" : {  
"html\_strip" : {  
"type" : "html\_strip"  
}  
},  
"analyzer" : {  
"standard" : {  
"type" : "standard"  
},  
"autocomplete" : {  
"filter" : ["standard", "lowercase"],  
"char\_filter" : ["html\_strip"],  
"type" : "custom",  
"tokenizer" : "edgeNGram"  
},  
"search" : {  
"filter" : ["standard", "asciifolding", "edgeNGram", "lowercase", "shingle", "snowball", "stop", "synonym"],  
"char\_filter" : ["html\_strip"],  
"type" : "custom",  
"tokenizer" : "standard"  
}  
},  
"tokenizer" : {  
"standard" : {  
"type" : "standard"  
},  
"edgeNGram" : {  
"token\_chars" : ["letter", "digit"],  
"min\_gram" : "1",  
"type" : "edge\_ngram",  
"max\_gram" : "25"  
}  
}  
},  
"number\_of\_shards" : "5",  
"number\_of\_replicas" : "1",  
"uuid" : "RClDLTfzSAelYNQBFu80Ww",  
"version" : {  
"created" : "2030399"  
}  
}  
},  
"warmers" : { }  
}  
}

---

<div class="post-metadata">

**Author:** ![totessusan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/totessusan/32/13028_2.png) [@totessusan](https://discuss.elastic.co/u/totessusan)\
**Post date:** [November 2, 2016, 11:53pm UTC](https://discuss.elastic.co/t/how-can-you-set-a-custom-analyzer-on-the--content-field-of-a-mapper-attachment-during-index-creation/64777/2 "2016-11-02T23:53:42Z")

</div>

Realized that the "\_content" field is actually the "FileField" attribute on the Attachment object when establishing a mapping.

[RESOLVED]

---

<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:** [July 5, 2017, 10:07pm UTC](https://discuss.elastic.co/t/how-can-you-set-a-custom-analyzer-on-the--content-field-of-a-mapper-attachment-during-index-creation/64777/3 "2017-07-05T22:07:07Z")

</div>


