# Multiple words but same token

**URL:** <https://discuss.elastic.co/t/multiple-words-but-same-token/22252>\
**Category:** Elasticsearch\
**Created:** [February 18, 2015, 10:45pm UTC](https://discuss.elastic.co/t/multiple-words-but-same-token/22252 "2015-02-18T22:45:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicom/32/488_2.png) [@nicom](https://discuss.elastic.co/u/nicom)\
**Post date:** [February 18, 2015, 10:45pm UTC](https://discuss.elastic.co/t/multiple-words-but-same-token/22252/1 "2015-02-18T22:45:42Z")

</div>

Hi,

I would like to index

"driving with car A is a bad thing"

knowing that I have special words composed of several words e.g. "car A"  
and "car B".

if I use standard appraoch the a or b are lost. ideally for "driving with  
car A is a bad thing" the analyzer should return this:  
( "driving", "car A", "bad", "thing")

help, how will you do that?

* * *

my filters night well  
filter: {  
protect\_words:{  
type: "keyword\_marker",  
keywords: "car a", "car b"]  
},  
protect\_words2:{  
type: "word\_delimiter",  
protected\_words: ["car a", "car b"]  
}  
},  
analyzer: {

```
    custom_level2: {  
     tokenizer: 'standard',        
      filter: ["asciifolding", "lowercase", "protect_words"],
      type: 'custom'
    },
    custom_level1: {       
      tokenizer: 'keyword',   
      filter: ["asciifolding", "lowercase", "protect_words2"],
      type: 'custom'
    },
}

```

}

any help?

--  
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/3aa288d7-19b4-4f49-b321-feccfd2b30a5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3aa288d7-19b4-4f49-b321-feccfd2b30a5%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 19, 2015, 6:45am UTC](https://discuss.elastic.co/t/multiple-words-but-same-token/22252/2 "2015-02-19T06:45:13Z")

</div>

This will not produce exactly what your are looking for but I would use shingles: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-shingle-tokenfilter.html)

And boost results found with the shingle analyzer than the standard analyzer So results containing "car A" will appear first.

David

> Le 18 févr. 2015 à 23:45, NM [n.maisonneuve@gmail.com](mailto:n.maisonneuve@gmail.com) a écrit :
> 
> Hi,
> 
> I would like to index
> 
> "driving with car A is a bad thing"
> 
> knowing that I have special words composed of several words e.g. "car A" and "car B".
> 
> if I use standard appraoch the a or b are lost. ideally for "driving with car A is a bad thing" the analyzer should return this:  
> ( "driving", "car A", "bad", "thing")
> 
> help, how will you do that?
> 
> * * *
> 
> my filters night well  
> filter: {  
> protect\_words:{  
> type: "keyword\_marker",  
> keywords: "car a", "car b"]  
> },  
> protect\_words2:{  
> type: "word\_delimiter",  
> protected\_words: ["car a", "car b"]  
> }  
> },   
> analyzer: {
> 
> ```
> custom_level2: {  
> tokenizer: 'standard',        
> filter: ["asciifolding", "lowercase", "protect_words"],
> type: 'custom'
> },
> custom_level1: {       
> tokenizer: 'keyword',   
> filter: ["asciifolding", "lowercase", "protect_words2"],
> type: 'custom'
> },
> }
> 
> ```
> 
> }
> 
> any help?
> 
> --  
> 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/3aa288d7-19b4-4f49-b321-feccfd2b30a5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3aa288d7-19b4-4f49-b321-feccfd2b30a5%40googlegroups.com).  
> 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/F696CA5D-600E-4FA7-BA8C-C869B21B2B40%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/F696CA5D-600E-4FA7-BA8C-C869B21B2B40%40pilato.fr).  
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, 12:31am UTC](https://discuss.elastic.co/t/multiple-words-but-same-token/22252/3 "2017-07-06T00:31:37Z")

</div>


