# Need help with mapping

**URL:** <https://discuss.elastic.co/t/need-help-with-mapping/9416>\
**Category:** Elasticsearch\
**Created:** [October 18, 2012, 8:10pm UTC](https://discuss.elastic.co/t/need-help-with-mapping/9416 "2012-10-18T20:10:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NLS](https://avatars.discourse-cdn.com/v4/letter/n/848f3c/32.png) [@NLS](https://discuss.elastic.co/u/NLS)\
**Post date:** [October 18, 2012, 8:10pm UTC](https://discuss.elastic.co/t/need-help-with-mapping/9416/1 "2012-10-18T20:10:15Z")

</div>

I have some fields like modelName that can have a dash or pipe  
(example: Owner\_at\_1-1tenth\_Boxes|1.1").

I want the user to be able to search for this modelName via "Owner\*" or  
"Owner\_at\_1\*" or "Owner\_at\_1-1\*" and get this document.

But by default it splits the word on the hypen and pipe character so the  
searches I am doing with query\_string don't give me the correct results.

I searched around and think I need to set the \_mapping to use  
index\_analyzer word-delimiter with generate\_word\_parts = true,  
catenate\_words = true, preserve\_original = true but don;t know how to set  
that command. What search analyzer should I use, I was thinking keyword.

I think I need to set \_mapping to  
{  
"spatial\_metadata":  
{  
"properties":  
{  
"alias":  
{  
"type": "string",  
"index\_analyzer": "word-delimiter",  
"search\_analyzer": "keyword"  
},  
"modelName":  
{  
"type": "string",  
"index\_analyzer": "word-delimiter",  
"search\_analyzer": "keyword"  
}  
}  
}  
}

But where does the generate\_word\_parts = true, catenate\_words = true,  
preserve\_original = true part go?

I just want to be able to do queries with wildcards and this field to be  
one term. But when I set keyword or not\_analyzer then I cannot do a  
query\_string with a wildcard.

--

---

<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 6, 2017, 3:08am UTC](https://discuss.elastic.co/t/need-help-with-mapping/9416/2 "2017-07-06T03:08:00Z")

</div>


