# Help with mapping

**URL:** <https://discuss.elastic.co/t/help-with-mapping/5111>\
**Category:** Elasticsearch\
**Created:** [August 10, 2011, 11:27am UTC](https://discuss.elastic.co/t/help-with-mapping/5111 "2011-08-10T11:27:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sindre\_Sorhus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sindre_sorhus/32/3138_2.png) [@Sindre\_Sorhus](https://discuss.elastic.co/u/Sindre_Sorhus)\
**Post date:** [August 10, 2011, 11:27am UTC](https://discuss.elastic.co/t/help-with-mapping/5111/1 "2011-08-10T11:27:47Z")

</div>

Since our company's ActiveDirectory service is not indexed, I've given up on  
using to search. I was really excited when I found how easy ES was, even  
though lacking some documentation.

The plan is to dump some AD fields into ES and create a search interface for  
it.

Since I have never used ES before I was hoping for some guidance on how to  
map and analyze some fields.

Mapping: [https://gist.github.com/1136586](https://gist.github.com/1136586)  
Example doc: [https://gist.github.com/1136580](https://gist.github.com/1136580)

What's the best way to map the "office" field. The field always consist of  
the location and then the office. Should I parse it beforehand and save it  
as an array, or is there a tokenizer for this?

Same with "job\_phone" (internal/external number) and "tags", should I parse  
it first or is there a tokenizer or another method for doing this?

On the "department" field I think the "whitespace" analyzer fits.

Any other thoughts, recommendations?

---

<div class="post-metadata">

**Author:** ![Jan\_Fiedler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jan_fiedler/32/2518_2.png) [@Jan\_Fiedler](https://discuss.elastic.co/u/Jan_Fiedler)\
**Post date:** [August 10, 2011, 12:08pm UTC](https://discuss.elastic.co/t/help-with-mapping/5111/2 "2011-08-10T12:08:29Z")

</div>

Selecting the right analyzer very much depends on your search use cases  
(e.g. do you want to find documents based on an office location (or must the  
office be provided as well)). ElasticSearch has many analyzers and filters  
to choose from. For your purposes you probably want to take a look at

- PatternAnalyzer  
([http://www.elasticsearch.org/guide/reference/index-modules/analysis/pattern-analyzer.html](http://www.elasticsearch.org/guide/reference/index-modules/analysis/pattern-analyzer.html))
- WordDelimiterFilter  
([http://www.elasticsearch.org/guide/reference/index-modules/analysis/word-delimiter-tokenfilter.html](http://www.elasticsearch.org/guide/reference/index-modules/analysis/word-delimiter-tokenfilter.html))

Make sure you read the good user guide section on the analysis index module  
([http://www.elasticsearch.org/guide/reference/index-modules/analysis/](http://www.elasticsearch.org/guide/reference/index-modules/analysis/)) and  
try out your configurations with the analyze API (  
[http://www.elasticsearch.org/guide/reference/api/admin-indices-analyze.html](http://www.elasticsearch.org/guide/reference/api/admin-indices-analyze.html)  
).

---

<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:57am UTC](https://discuss.elastic.co/t/help-with-mapping/5111/3 "2017-07-06T03:57:38Z")

</div>


