# Need mapping (or query) tips

**URL:** <https://discuss.elastic.co/t/need-mapping-or-query-tips/18692>\
**Category:** Elasticsearch\
**Created:** [July 16, 2014, 8:49am UTC](https://discuss.elastic.co/t/need-mapping-or-query-tips/18692 "2014-07-16T08:49:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Loic\_Wenkin](https://avatars.discourse-cdn.com/v4/letter/l/4491bb/32.png) [@Loic\_Wenkin](https://discuss.elastic.co/u/Loic_Wenkin)\
**Post date:** [July 16, 2014, 8:49am UTC](https://discuss.elastic.co/t/need-mapping-or-query-tips/18692/1 "2014-07-16T08:49:36Z")

</div>

Hello everybody,

I am working on a multilingual project and I need some tips about mapping  
(or queries). I have two needs :

- I would like to benefit of the full text power and specific language  
analyzers power on a field of my documents. I need that for some of my  
searches. Users can do some search like (Hello toto) that will return  
documents containing (Hello, my name is toto) (1).
- On the other hand, users have also the ability to do some search like  
("Hello toto") that won't return documents containing ("Hello, my name is  
toto"), but they will only return documents containing ("Hello toto") (a  
little bit as Google do when we use quotes) (2).

Currently, in my mapping, I have something like that:

{  
"myfieldinfrench": {  
...  
"analyzer": "french"  
}  
}

This allow me to easily meet my first need, but not my second one.

I was thinking to index twice the field (using multi field types) but is it  
a good idea? Won't it increase my index size?

Is there another way than using multi fields to meet my needs?

Thanks a lot for your replies.

Regards,  
Loïc Wenkin

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/70b46c78-5e03-4ff9-8cd6-ba2217642fa2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/70b46c78-5e03-4ff9-8cd6-ba2217642fa2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 28, 2014, 12:14pm UTC](https://discuss.elastic.co/t/need-mapping-or-query-tips/18692/2 "2014-07-28T12:14:42Z")

</div>

Hey,

you might want to use the phrase match query and check out its slop  
parameter for your second requirement. See

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

--Alex

On Wed, Jul 16, 2014 at 10:49 AM, Loïc Wenkin [loic.wenkin@gmail.com](mailto:loic.wenkin@gmail.com) wrote:

> Hello everybody,
> 
> I am working on a multilingual project and I need some tips about mapping  
> (or queries). I have two needs :
> 
> - I would like to benefit of the full text power and specific language  
> analyzers power on a field of my documents. I need that for some of my  
> searches. Users can do some search like (Hello toto) that will return  
> documents containing (Hello, my name is toto) (1).
> - On the other hand, users have also the ability to do some search like  
> ("Hello toto") that won't return documents containing ("Hello, my name is  
> toto"), but they will only return documents containing ("Hello toto") (a  
> little bit as Google do when we use quotes) (2).
> 
> Currently, in my mapping, I have something like that:
> 
> {  
> "myfieldinfrench": {  
> ...  
> "analyzer": "french"  
> }  
> }
> 
> This allow me to easily meet my first need, but not my second one.
> 
> I was thinking to index twice the field (using multi field types) but is  
> it a good idea? Won't it increase my index size?
> 
> Is there another way than using multi fields to meet my needs?
> 
> Thanks a lot for your replies.
> 
> Regards,  
> Loïc Wenkin
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/70b46c78-5e03-4ff9-8cd6-ba2217642fa2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/70b46c78-5e03-4ff9-8cd6-ba2217642fa2%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/70b46c78-5e03-4ff9-8cd6-ba2217642fa2%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/70b46c78-5e03-4ff9-8cd6-ba2217642fa2%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGCwEM\_BgBOWrJ5vQT4R-%3DY6XohyyAdUQi7T%3Dp\_d%2BFUxX8KS%3Dg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM_BgBOWrJ5vQT4R-%3DY6XohyyAdUQi7T%3Dp_d%2BFUxX8KS%3Dg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Loic\_Wenkin](https://avatars.discourse-cdn.com/v4/letter/l/4491bb/32.png) [@Loic\_Wenkin](https://discuss.elastic.co/u/Loic_Wenkin)\
**Post date:** [July 28, 2014, 12:41pm UTC](https://discuss.elastic.co/t/need-mapping-or-query-tips/18692/3 "2014-07-28T12:41:39Z")

</div>

Hi Alexander,

Thanks a lot for your reply! Can you explain a little bit what is this  
"slop" parameter?

Loïc

Le lundi 28 juillet 2014 14:14:56 UTC+2, Alexander Reelsen a écrit :

> Hey,
> 
> you might want to use the phrase match query and check out its slop  
> parameter for your second requirement. See  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#_phrase)
> 
> --Alex
> 
> On Wed, Jul 16, 2014 at 10:49 AM, Loïc Wenkin \<[loic....@gmail.com](mailto:loic....@gmail.com)  
> \<javascript:\>\> wrote:
> 
> > Hello everybody,
> > 
> > I am working on a multilingual project and I need some tips about mapping  
> > (or queries). I have two needs :
> > 
> > - I would like to benefit of the full text power and specific language  
> > analyzers power on a field of my documents. I need that for some of my  
> > searches. Users can do some search like (Hello toto) that will return  
> > documents containing (Hello, my name is toto) (1).
> > - On the other hand, users have also the ability to do some search like  
> > ("Hello toto") that won't return documents containing ("Hello, my name is  
> > toto"), but they will only return documents containing ("Hello toto") (a  
> > little bit as Google do when we use quotes) (2).
> > 
> > Currently, in my mapping, I have something like that:
> > 
> > {  
> > "myfieldinfrench": {  
> > ...  
> > "analyzer": "french"  
> > }  
> > }
> > 
> > This allow me to easily meet my first need, but not my second one.
> > 
> > I was thinking to index twice the field (using multi field types) but is  
> > it a good idea? Won't it increase my index size?
> > 
> > Is there another way than using multi fields to meet my needs?
> > 
> > Thanks a lot for your replies.
> > 
> > Regards,  
> > Loïc Wenkin
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/70b46c78-5e03-4ff9-8cd6-ba2217642fa2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/70b46c78-5e03-4ff9-8cd6-ba2217642fa2%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/70b46c78-5e03-4ff9-8cd6-ba2217642fa2%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/70b46c78-5e03-4ff9-8cd6-ba2217642fa2%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/fc1edcdd-f833-426d-92cf-eb7c1026dc45%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/fc1edcdd-f833-426d-92cf-eb7c1026dc45%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Loic\_Wenkin](https://avatars.discourse-cdn.com/v4/letter/l/4491bb/32.png) [@Loic\_Wenkin](https://discuss.elastic.co/u/Loic_Wenkin)\
**Post date:** [July 28, 2014, 1:28pm UTC](https://discuss.elastic.co/t/need-mapping-or-query-tips/18692/4 "2014-07-28T13:28:50Z")

</div>

I answer myself to my question: slop is the max number of "permutation" we  
have to do in the results to get a match.  
(See [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/slop.html))

Le lundi 28 juillet 2014 14:41:39 UTC+2, Loïc Wenkin a écrit :

> Hi Alexander,
> 
> Thanks a lot for your reply! Can you explain a little bit what is this  
> "slop" parameter?
> 
> Loïc
> 
> Le lundi 28 juillet 2014 14:14:56 UTC+2, Alexander Reelsen a écrit :
> 
> > Hey,
> > 
> > you might want to use the phrase match query and check out its slop  
> > parameter for your second requirement. See  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#_phrase)
> > 
> > --Alex
> > 
> > On Wed, Jul 16, 2014 at 10:49 AM, Loïc Wenkin [loic....@gmail.com](mailto:loic....@gmail.com) wrote:
> > 
> > > Hello everybody,
> > > 
> > > I am working on a multilingual project and I need some tips about  
> > > mapping (or queries). I have two needs :
> > > 
> > > - I would like to benefit of the full text power and specific language  
> > > analyzers power on a field of my documents. I need that for some of my  
> > > searches. Users can do some search like (Hello toto) that will return  
> > > documents containing (Hello, my name is toto) (1).
> > > - On the other hand, users have also the ability to do some search like  
> > > ("Hello toto") that won't return documents containing ("Hello, my name is  
> > > toto"), but they will only return documents containing ("Hello toto") (a  
> > > little bit as Google do when we use quotes) (2).
> > > 
> > > Currently, in my mapping, I have something like that:
> > > 
> > > {  
> > > "myfieldinfrench": {  
> > > ...  
> > > "analyzer": "french"  
> > > }  
> > > }
> > > 
> > > This allow me to easily meet my first need, but not my second one.
> > > 
> > > I was thinking to index twice the field (using multi field types) but is  
> > > it a good idea? Won't it increase my index size?
> > > 
> > > Is there another way than using multi fields to meet my needs?
> > > 
> > > Thanks a lot for your replies.
> > > 
> > > Regards,  
> > > Loïc Wenkin
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/70b46c78-5e03-4ff9-8cd6-ba2217642fa2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/70b46c78-5e03-4ff9-8cd6-ba2217642fa2%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/70b46c78-5e03-4ff9-8cd6-ba2217642fa2%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/70b46c78-5e03-4ff9-8cd6-ba2217642fa2%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/70aee8fa-a2ae-45e0-bc45-02ad505e6e73%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/70aee8fa-a2ae-45e0-bc45-02ad505e6e73%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:12am UTC](https://discuss.elastic.co/t/need-mapping-or-query-tips/18692/5 "2017-07-06T01:12:48Z")

</div>

Closed on July 6, 2017, 1:12am UTC


