# Mapping for exact or partial matches

**URL:** <https://discuss.elastic.co/t/mapping-for-exact-or-partial-matches/82143>\
**Category:** Elasticsearch\
**Created:** [April 12, 2017, 11:16am UTC](https://discuss.elastic.co/t/mapping-for-exact-or-partial-matches/82143 "2017-04-12T11:16:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikemi](https://avatars.discourse-cdn.com/v4/letter/m/ec9cab/32.png) [@mikemi](https://discuss.elastic.co/u/mikemi)\
**Post date:** [April 12, 2017, 11:16am UTC](https://discuss.elastic.co/t/mapping-for-exact-or-partial-matches/82143/1 "2017-04-12T11:16:40Z")

</div>

Trying to wrap my head around mapping and wondering how to handle a property that would need to be used for both full and partial matching.

For example, the `referrer` property in an apache log.

I want to be able to create searches against this property for both exact matches, or partial matches (let's say so I can find all records coming from the domain in the referrer).

From what I understand, I cannot achieve exact matches with text properties, or partials with keywords.

The only thing I can think of is to create 2 properties, one of each type, but that does not sound very sane.

Any insight on the best approach for this would be appreciated.

**Update** :

I found this: [https://www.elastic.co/blog/strings-are-dead-long-live-strings](https://www.elastic.co/blog/strings-are-dead-long-live-strings)

So `string` stores values as both `keyword` and `text`. Then I would use `referrer:foo` for a text search and `referrer.keyword:foo` for an exact match keyword search.

Is that correct?

---

<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:** [May 10, 2017, 11:19am UTC](https://discuss.elastic.co/t/mapping-for-exact-or-partial-matches/82143/2 "2017-05-10T11:19:20Z")

</div>

Closed on May 10, 2017, 11:19am UTC

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