# Search with white space

**URL:** <https://discuss.elastic.co/t/search-with-white-space/3979>\
**Category:** Elasticsearch\
**Created:** [February 25, 2011, 9:58am UTC](https://discuss.elastic.co/t/search-with-white-space/3979 "2011-02-25T09:58:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandre\_Heimburger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexandre_heimburger/32/2941_2.png) [@Alexandre\_Heimburger](https://discuss.elastic.co/u/Alexandre_Heimburger)\
**Post date:** [February 25, 2011, 9:58am UTC](https://discuss.elastic.co/t/search-with-white-space/3979/1 "2011-02-25T09:58:54Z")

</div>

I'm working on a super fast completion engine using ES.

I'm using a wildcard term so everything is OK when I type one term.

But if I start typing a sentence (like the title of the conversation I  
want to read), the query does not return anything.

I've read that I should mark the searched field as "not\_analyzed" but  
I don't figure out how to do that.

thx

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [February 25, 2011, 1:01pm UTC](https://discuss.elastic.co/t/search-with-white-space/3979/2 "2011-02-25T13:01:31Z")

</div>

Hi,

Check the "index":"not\_analyzed" attribute/value in mappings, for example  
here: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/core-types.html)  
May be you should also consider using prefix query:  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html)

[http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html)  
Regards,  
Lukas

On Fri, Feb 25, 2011 at 10:58 AM, alheim [alexheimburger@gmail.com](mailto:alexheimburger@gmail.com) wrote:

> I'm working on a super fast completion engine using ES.
> 
> I'm using a wildcard term so everything is OK when I type one term.
> 
> But if I start typing a sentence (like the title of the conversation I  
> want to read), the query does not return anything.
> 
> I've read that I should mark the searched field as "not\_analyzed" but  
> I don't figure out how to do that.
> 
> thx

---

<div class="post-metadata">

**Author:** ![Alexandre\_Heimburger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexandre_heimburger/32/2941_2.png) [@Alexandre\_Heimburger](https://discuss.elastic.co/u/Alexandre_Heimburger)\
**Post date:** [February 25, 2011, 1:34pm UTC](https://discuss.elastic.co/t/search-with-white-space/3979/3 "2011-02-25T13:34:22Z")

</div>

I tried to use "index":"not\_analyzed". Not better.

Imagine that I want to index a document with a title "I want to become a ES  
expert"

If I search "I want" , there should be a hit.  
If I search "beco", there should be a hit  
and If I search "a ES expert", there should be a hit.

How do I need to configure the field ?

thanks for your help.

On Fri, Feb 25, 2011 at 2:01 PM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) wrote:

> Hi,
> 
> Check the "index":"not\_analyzed" attribute/value in mappings, for example  
> here: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/core-types.html)  
> May be you should also consider using prefix query:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html)
> 
> [http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html)  
> Regards,  
> Lukas
> 
> On Fri, Feb 25, 2011 at 10:58 AM, alheim [alexheimburger@gmail.com](mailto:alexheimburger@gmail.com) wrote:
> 
> > I'm working on a super fast completion engine using ES.
> > 
> > I'm using a wildcard term so everything is OK when I type one term.
> > 
> > But if I start typing a sentence (like the title of the conversation I  
> > want to read), the query does not return anything.
> > 
> > I've read that I should mark the searched field as "not\_analyzed" but  
> > I don't figure out how to do that.
> > 
> > thx

--  
Alexandre Heimburger  
R&D Manager  
blueKiwi Software  
tel : +33687880997  
email : [ahb@bluekiwi-software.com](mailto:ahb@bluekiwi-software.com)  
adress : 93 rue Vieille du Temple, 75003 Paris

What is blueKiwi? blueKiwi - the first Enterprise Social Software Suite in  
the world building professional networks on conversations and relationships

- helps large organizations increase their productivity, foster innovations  
and boost people satisfaction.

---

<div class="post-metadata">

**Author:** ![Alexandre\_Heimburger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexandre_heimburger/32/2941_2.png) [@Alexandre\_Heimburger](https://discuss.elastic.co/u/Alexandre_Heimburger)\
**Post date:** [February 25, 2011, 5:57pm UTC](https://discuss.elastic.co/t/search-with-white-space/3979/4 "2011-02-25T17:57:41Z")

</div>

Thx for help.

I followed these steps :

Into config/elasticsearch.yml, add a custom analyzer

index:  
analysis :  
analyzer :  
lowercase\_keyword :  
type : custom  
filter : [lowercase]  
tokenizer : keyword

Call the URL :

curl -XPUT '[http://localhost:9200/devalex10/post/\_mapping](http://localhost:9200/devalex10/post/_mapping)' -d '  
{  
"post" : {  
"properties" : {  
"title" : {"type":"string",  
"analyzer":"lowercase\_keyword"}  
}  
}  
}

IMPORTANT : if the index already exist, one should get an error saying  
that there is a merge conflict. Do not attempt to use the ignore\_merge  
parameter which will just ignore the new analyzer. The solution is to  
scratch the index et index again.

Any other idea ?

On 25 fév, 14:01, Lukáš Vlček [lukas.vl...@gmail.com](mailto:lukas.vl...@gmail.com) wrote:

> Hi,
> 
> Check the "index":"not\_analyzed" attribute/value in mappings, for example  
> here:[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/core-types.html)  
> May be you should also consider using prefix query:[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html)
> 
> [http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html)  
> Regards,  
> Lukas
> 
> On Fri, Feb 25, 2011 at 10:58 AM, alheim [alexheimbur...@gmail.com](mailto:alexheimbur...@gmail.com) wrote:
> 
> > I'm working on a super fast completion engine using ES.
> 
> > I'm using a wildcard term so everything is OK when I type one term.
> 
> > But if I start typing a sentence (like the title of the conversation I  
> > want to read), the query does not return anything.
> 
> > I've read that I should mark the searched field as "not\_analyzed" but  
> > I don't figure out how to do that.
> 
> > thx

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 26, 2011, 8:38pm UTC](https://discuss.elastic.co/t/search-with-white-space/3979/5 "2011-02-26T20:38:04Z")

</div>

You can do a combination of several options. For example, use a multi field mapping that have it both not analyzed, analyzed once with ngrams, and another option to analyze it with shingles ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/analysis/shingle-tokenfilter.html)).

Then, you can query those fields in a single search request, either using several queries, or using a query string that runs against those.  
On Friday, February 25, 2011 at 3:34 PM, Alexandre Heimburger wrote:

> I tried to use "index":"not\_analyzed". Not better.
> 
> Imagine that I want to index a document with a title "I want to become a ES expert"
> 
> If I search "I want" , there should be a hit.  
> If I search "beco", there should be a hit  
> and If I search "a ES expert", there should be a hit.
> 
> How do I need to configure the field ?
> 
> thanks for your help.
> 
> On Fri, Feb 25, 2011 at 2:01 PM, LukÃ¡Å¡ VlÄek [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) wrote:
> 
> > Hi,
> > 
> > Check the "index":"not\_analyzed" attribute/value in mappings, for example here: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/core-types.html)  
> > May be you should also consider using prefix query: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html)
> > 
> > Regards,  
> > Lukas
> > 
> > On Fri, Feb 25, 2011 at 10:58 AM, alheim [alexheimburger@gmail.com](mailto:alexheimburger@gmail.com) wrote:
> > 
> > > I'm working on a super fast completion engine using ES.
> > > 
> > > I'm using a wildcard term so everything is OK when I type one term.
> > > 
> > > But if I start typing a sentence (like the title of the conversation I  
> > > want to read), the query does not return anything.
> > > 
> > > I've read that I should mark the searched field as "not\_analyzed" but  
> > > I don't figure out how to do that.
> > > 
> > > thx
> 
> --  
> Alexandre Heimburger  
> R&D Manager  
> blueKiwi Software  
> tel : +33687880997  
> email : [ahb@bluekiwi-software.com](mailto:ahb@bluekiwi-software.com)  
> adress : 93 rue Vieille du Temple, 75003 Paris
> 
> What is blueKiwi? blueKiwi - the first Enterprise Social Software Suite in the world building professional networks on conversations and relationships - helps large organizations increase their productivity, foster innovations and boost people satisfaction.

---

<div class="post-metadata">

**Author:** ![Alexandre\_Heimburger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexandre_heimburger/32/2941_2.png) [@Alexandre\_Heimburger](https://discuss.elastic.co/u/Alexandre_Heimburger)\
**Post date:** [February 28, 2011, 7:27am UTC](https://discuss.elastic.co/t/search-with-white-space/3979/6 "2011-02-28T07:27:36Z")

</div>

ok. does that mean that the text will be indexed 2 times ?

On Sat, Feb 26, 2011 at 9:38 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> You can do a combination of several options. For example, use a multi  
> field mapping that have it both not analyzed, analyzed once with ngrams, and  
> another option to analyze it with shingles (  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/analysis/shingle-tokenfilter.html)  
> ).
> 
> Then, you can query those fields in a single search request, either using  
> several queries, or using a query string that runs against those.
> 
> On Friday, February 25, 2011 at 3:34 PM, Alexandre Heimburger wrote:
> 
> I tried to use "index":"not\_analyzed". Not better.
> 
> Imagine that I want to index a document with a title "I want to become a ES  
> expert"
> 
> If I search "I want" , there should be a hit.  
> If I search "beco", there should be a hit  
> and If I search "a ES expert", there should be a hit.
> 
> How do I need to configure the field ?
> 
> thanks for your help.
> 
> On Fri, Feb 25, 2011 at 2:01 PM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com)wrote:
> 
> Hi,
> 
> Check the "index":"not\_analyzed" attribute/value in mappings, for example  
> here: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/core-types.html)  
> May be you should also consider using prefix query:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html)
> 
> [http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html)  
> Regards,  
> Lukas
> 
> On Fri, Feb 25, 2011 at 10:58 AM, alheim [alexheimburger@gmail.com](mailto:alexheimburger@gmail.com) wrote:
> 
> I'm working on a super fast completion engine using ES.
> 
> I'm using a wildcard term so everything is OK when I type one term.
> 
> But if I start typing a sentence (like the title of the conversation I  
> want to read), the query does not return anything.
> 
> I've read that I should mark the searched field as "not\_analyzed" but  
> I don't figure out how to do that.
> 
> thx
> 
> --  
> Alexandre Heimburger  
> R&D Manager  
> blueKiwi Software  
> tel : +33687880997  
> email : [ahb@bluekiwi-software.com](mailto:ahb@bluekiwi-software.com)  
> adress : 93 rue Vieille du Temple, 75003 Paris
> 
> What is blueKiwi? blueKiwi - the first Enterprise Social Software Suite in  
> the world building professional networks on conversations and relationships
> 
> - helps large organizations increase their productivity, foster innovations  
> and boost people satisfaction.

--  
Alexandre Heimburger  
R&D Manager  
blueKiwi Software  
tel : +33687880997  
email : [ahb@bluekiwi-software.com](mailto:ahb@bluekiwi-software.com)  
adress : 93 rue Vieille du Temple, 75003 Paris

What is blueKiwi? blueKiwi - the first Enterprise Social Software Suite in  
the world building professional networks on conversations and relationships

- helps large organizations increase their productivity, foster innovations  
and boost people satisfaction.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 2, 2011, 12:41am UTC](https://discuss.elastic.co/t/search-with-white-space/3979/7 "2011-03-02T00:41:56Z")

</div>

Yes, it will be indexed several times with different "term" combinations.  
On Monday, February 28, 2011 at 9:27 AM, Alexandre Heimburger wrote:

> ok. does that mean that the text will be indexed 2 times ?
> 
> On Sat, Feb 26, 2011 at 9:38 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > You can do a combination of several options. For example, use a multi field mapping that have it both not analyzed, analyzed once with ngrams, and another option to analyze it with shingles ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/analysis/shingle-tokenfilter.html)).
> > 
> > Then, you can query those fields in a single search request, either using several queries, or using a query string that runs against those.  
> > On Friday, February 25, 2011 at 3:34 PM, Alexandre Heimburger wrote:
> > 
> > > I tried to use "index":"not\_analyzed". Not better.
> > > 
> > > Imagine that I want to index a document with a title "I want to become a ES expert"
> > > 
> > > If I search "I want" , there should be a hit.  
> > > If I search "beco", there should be a hit  
> > > and If I search "a ES expert", there should be a hit.
> > > 
> > > How do I need to configure the field ?
> > > 
> > > thanks for your help.
> > > 
> > > On Fri, Feb 25, 2011 at 2:01 PM, LukÃ¡Å¡ VlÄek [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) wrote:
> > > 
> > > > Hi,
> > > > 
> > > > Check the "index":"not\_analyzed" attribute/value in mappings, for example here: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/core-types.html)  
> > > > May be you should also consider using prefix query: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html)
> > > > 
> > > > Regards,  
> > > > Lukas
> > > > 
> > > > On Fri, Feb 25, 2011 at 10:58 AM, alheim [alexheimburger@gmail.com](mailto:alexheimburger@gmail.com) wrote:
> > > > 
> > > > > I'm working on a super fast completion engine using ES.
> > > > > 
> > > > > I'm using a wildcard term so everything is OK when I type one term.
> > > > > 
> > > > > But if I start typing a sentence (like the title of the conversation I  
> > > > > want to read), the query does not return anything.
> > > > > 
> > > > > I've read that I should mark the searched field as "not\_analyzed" but  
> > > > > I don't figure out how to do that.
> > > > > 
> > > > > thx
> > > 
> > > --  
> > > Alexandre Heimburger  
> > > R&D Manager  
> > > blueKiwi Software  
> > > tel : +33687880997  
> > > email : [ahb@bluekiwi-software.com](mailto:ahb@bluekiwi-software.com)  
> > > adress : 93 rue Vieille du Temple, 75003 Paris
> > > 
> > > What is blueKiwi? blueKiwi - the first Enterprise Social Software Suite in the world building professional networks on conversations and relationships - helps large organizations increase their productivity, foster innovations and boost people satisfaction.
> 
> --  
> Alexandre Heimburger  
> R&D Manager  
> blueKiwi Software  
> tel : +33687880997  
> email : [ahb@bluekiwi-software.com](mailto:ahb@bluekiwi-software.com)  
> adress : 93 rue Vieille du Temple, 75003 Paris
> 
> What is blueKiwi? blueKiwi - the first Enterprise Social Software Suite in the world building professional networks on conversations and relationships - helps large organizations increase their productivity, foster innovations and boost people satisfaction.

---

<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, 4:11am UTC](https://discuss.elastic.co/t/search-with-white-space/3979/8 "2017-07-06T04:11:06Z")

</div>


