# Query problem

**URL:** https://discuss.elastic.co/t/query-problem/19253
**Category:** Elasticsearch
**Created:** [August 13, 2014, 12:39pm UTC](https://discuss.elastic.co/t/query-problem/19253 "2014-08-13T12:39:17Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Luc\_Evers](https://avatars.discourse-cdn.com/v4/letter/l/aeb1de/32.png) [@Luc\_Evers](https://discuss.elastic.co/u/Luc_Evers)
#### Post date: [August 13, 2014, 12:39pm UTC](https://discuss.elastic.co/t/query-problem/19253/1 "2014-08-13T12:39:17Z")

</div>

I like to use elasticsearch as Nosql database + search engine for data  
coming from text files (router configs) and databases .  
First I moved a routerconfig to a json file which I indexed .

Mapping:

{  
"configs" : {  
"mappings" : {  
"test" : {  
"properties" : {  
"ConfLength" : {  
"type" : "string"  
},  
"NVRAM" : {  
"type" : "string"  
},  
"aaa" : {  
"type" : "string"  
},  
"enable" : {  
"type" : "string"  
},  
"hostname" : {  
"type" : "string"  
},  
"lastChange" : {  
"type" : "string"  
},  
"logging" : {  
"type" : "string"  
},  
"model" : {  
"type" : "string"  
},  
"policy-map" : {  
"type" : "string"  
}  
}  
}  
}  
}  
}

Document:

{  
"\_index" : "configs",  
"\_type" : "test",  
"\_id" : "7",  
"\_score" : 1,  
"\_source" : {  
"hostname" : [  
"hostname test-1234"  
]  
}  
},

Example of a simple search: search a hostname.

_If I start a query_:

_curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"hostname test-1234"'_  
curl: (52) Empty reply from server

No respone

If I start a second query without hostname if got an answer:

_curl -XGET '[http://127.0.0.1:9200/configs/\_search?q="test-1234"](http://127.0.0.1:9200/configs/_search?q=%22test-1234%22)'_  
OKE

Analyser: standard

Why a search instruction can find "test-1234" but not "hostname test-1234"  
?

--  
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/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%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: [August 13, 2014, 12:46pm UTC](https://discuss.elastic.co/t/query-problem/19253/2 "2014-08-13T12:46:19Z")

</div>

Having no answer is not good. I think something goes wrong here. May be you should see something in logs.

That said, if you don't want to break your string as tokens at index time, you could set index:not\_analyzed for fields you don't want to analyze.

But, you should read this part of the book: [http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/analysis-intro.html#analysis-intro](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/analysis-intro.html#analysis-intro)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 13 août 2014 à 14:39:20, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:

I like to use elasticsearch as Nosql database + search engine for data coming from text files (router configs) and databases .  
First I moved a routerconfig to a json file which I indexed .

Mapping:

{  
"configs" : {  
"mappings" : {  
"test" : {  
"properties" : {  
"ConfLength" : {  
"type" : "string"  
},  
"NVRAM" : {  
"type" : "string"  
},  
"aaa" : {  
"type" : "string"  
},  
"enable" : {  
"type" : "string"  
},  
"hostname" : {  
"type" : "string"  
},  
"lastChange" : {  
"type" : "string"  
},  
"logging" : {  
"type" : "string"  
},  
"model" : {  
"type" : "string"  
},  
"policy-map" : {  
"type" : "string"  
}  
}  
}  
}  
}  
}

Document:

{  
"\_index" : "configs",  
"\_type" : "test",  
"\_id" : "7",  
"\_score" : 1,  
"\_source" : {  
"hostname" : [  
"hostname test-1234"  
]  
}  
},

Example of a simple search: search a hostname.

If I start a query:

curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"hostname test-1234"'  
curl: (52) Empty reply from server

No respone

If I start a second query without hostname if got an answer:

curl -XGET '[http://127.0.0.1:9200/configs/\_search?q="test-1234"](http://127.0.0.1:9200/configs/_search?q=%22test-1234%22)'  
OKE

Analyser: standard

Why a search instruction can find "test-1234" but not "hostname test-1234" ?

--  
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/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%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/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Luc\_Evers](https://avatars.discourse-cdn.com/v4/letter/l/aeb1de/32.png) [@Luc\_Evers](https://discuss.elastic.co/u/Luc_Evers)
#### Post date: [August 18, 2014, 1:39pm UTC](https://discuss.elastic.co/t/query-problem/19253/3 "2014-08-18T13:39:12Z")

</div>

David hi,

How can I configure the mapping so that the default analyzer will be the  
"whitespace" one?

On Wed, Aug 13, 2014 at 2:46 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> Having no answer is not good. I think something goes wrong here. May be  
> you should see something in logs.
> 
> That said, if you don't want to break your string as tokens at index time,  
> you could set index:not\_analyzed for fields you don't want to analyze.
> 
> But, you should read this part of the book:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/analysis-intro.html#analysis-intro)
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> 
> Le 13 août 2014 à 14:39:20, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> 
> I like to use elasticsearch as Nosql database + search engine for data  
> coming from text files (router configs) and databases .  
> First I moved a routerconfig to a json file which I indexed .
> 
> Mapping:
> 
> {  
> "configs" : {  
> "mappings" : {  
> "test" : {  
> "properties" : {  
> "ConfLength" : {  
> "type" : "string"  
> },  
> "NVRAM" : {  
> "type" : "string"  
> },  
> "aaa" : {  
> "type" : "string"  
> },  
> "enable" : {  
> "type" : "string"  
> },  
> "hostname" : {  
> "type" : "string"  
> },  
> "lastChange" : {  
> "type" : "string"  
> },  
> "logging" : {  
> "type" : "string"  
> },  
> "model" : {  
> "type" : "string"  
> },  
> "policy-map" : {  
> "type" : "string"  
> }  
> }  
> }  
> }  
> }  
> }
> 
> Document:
> 
> {  
> "\_index" : "configs",  
> "\_type" : "test",  
> "\_id" : "7",  
> "\_score" : 1,  
> "\_source" : {  
> "hostname" : [  
> "hostname test-1234"  
> ]  
> }  
> },
> 
> Example of a simple search: search a hostname.
> 
> _If I start a query_:
> 
> _curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)  
> [http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"hostname test-1234"'_  
> curl: (52) Empty reply from server
> 
> No respone
> 
> If I start a second query without hostname if got an answer:
> 
> _curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)  
> [http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"test-1234"'_  
> OKE
> 
> Analyser: standard
> 
> Why a search instruction can find "test-1234" but not "hostname test-1234"  
> ?
> 
> --  
> 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/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%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 a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
> To unsubscribe from this group and all its topics, 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/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local)  
> [https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local?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/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.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: [August 18, 2014, 1:42pm UTC](https://discuss.elastic.co/t/query-problem/19253/4 "2014-08-18T13:42:31Z")

</div>

I think could help you: [http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 18 août 2014 à 15:39:36, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:

David hi,

How can I configure the mapping so that the default analyzer will be the "whitespace" one?

On Wed, Aug 13, 2014 at 2:46 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
Having no answer is not good. I think something goes wrong here. May be you should see something in logs.

That said, if you don't want to break your string as tokens at index time, you could set index:not\_analyzed for fields you don't want to analyze.

But, you should read this part of the book: [http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/analysis-intro.html#analysis-intro](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/analysis-intro.html#analysis-intro)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 13 août 2014 à 14:39:20, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:

I like to use elasticsearch as Nosql database + search engine for data coming from text files (router configs) and databases .  
First I moved a routerconfig to a json file which I indexed .

Mapping:

{  
"configs" : {  
"mappings" : {  
"test" : {  
"properties" : {  
"ConfLength" : {  
"type" : "string"  
},  
"NVRAM" : {  
"type" : "string"  
},  
"aaa" : {  
"type" : "string"  
},  
"enable" : {  
"type" : "string"  
},  
"hostname" : {  
"type" : "string"  
},  
"lastChange" : {  
"type" : "string"  
},  
"logging" : {  
"type" : "string"  
},  
"model" : {  
"type" : "string"  
},  
"policy-map" : {  
"type" : "string"  
}  
}  
}  
}  
}  
}

Document:

{  
"\_index" : "configs",  
"\_type" : "test",  
"\_id" : "7",  
"\_score" : 1,  
"\_source" : {  
"hostname" : [  
"hostname test-1234"  
]  
}  
},

Example of a simple search: search a hostname.

If I start a query:

curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"hostname test-1234"'  
curl: (52) Empty reply from server

No respone

If I start a second query without hostname if got an answer:

curl -XGET '[http://127.0.0.1:9200/configs/\_search?q="test-1234"](http://127.0.0.1:9200/configs/_search?q=%22test-1234%22)'  
OKE

Analyser: standard

Why a search instruction can find "test-1234" but not "hostname test-1234" ?

--  
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/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%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 a topic in the Google Groups "elasticsearch" group.  
To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
To unsubscribe from this group and all its topics, 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/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local).

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/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.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/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Luc\_Evers](https://avatars.discourse-cdn.com/v4/letter/l/aeb1de/32.png) [@Luc\_Evers](https://discuss.elastic.co/u/Luc_Evers)
#### Post date: [August 19, 2014, 8:27am UTC](https://discuss.elastic.co/t/query-problem/19253/5 "2014-08-19T08:27:52Z")

</div>

David,

I made a small example to show you the problem and solution:

1. Index name: whitespace
2. type: mytest

_Mapping:_

{  
mappings: {  
"mytest": {  
"\_all": { "analyzer": "whitespace" }  
}  
}  
}

_Data_

{"hostname":["My-Name"]}

Indexing : oke

\*First Test: \* Is the analyzer = whitespace oke?

curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q="My"&pretty](http://localhost:9200/whitespace/mytest/_search?q=%22My%22&pretty)'  
{  
"took" : 3,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 0,  
"max\_score" : null,  
"hits" :   
}  
}

_Result: OKE_

_Second Test: Ask complete name_

curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q=](http://localhost:9200/whitespace/mytest/_search?q=)  
"My-Name"&pretty'  
{  
"took" : 4,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 0.30685282,  
"hits" : [ {  
"\_index" : "whitespace",  
"\_type" : "mytest",  
"\_id" : "2",  
"\_score" : 0.30685282,  
"\_source":{"hostname":"My-Name"}  
} ]  
}  
}

_Result: OKE_

_Now my problem:_

\*curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search](http://localhost:9200/whitespace/mytest/_search)  
[http://localhost:9200/whitespace/mytest/\_search](http://localhost:9200/whitespace/mytest/_search)" -d'\> {\> "query": { \>  
"filtered": {\> "filter": {\> "term": {  
"hostname": "My-Name" }\> } \> }\> }\>  
}'{"took":2,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":}}  
\*

_Because the document was indexed with the whitespace analyzer, he should  
find "My-Name"._

_Check Analyzer: OKE_  
curl -XGET 'localhost:9200/\_analyze?analyzer=whitespace&pretty&format=text'  
-d 'My-Name'  
{  
"tokens" : [ {  
"token" : "My-Name",  
"start\_offset" : 0,  
"end\_offset" : 7,  
"type" : "word",  
"position" : 1  
} ]  
}

_Test3: not\_analysed_ Index mapping:

{  
mappings: {  
"mytest": {  
"properties": {  
"hostname": {  
"type": "string",  
"index": "not\_analyzed"  
}  
}  
}  
}

_Then:_

curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search?pretty](http://localhost:9200/whitespace/mytest/_search?pretty)" -d'  
{  
"query": {  
"filtered": {  
"filter": {  
"term": { "hostname": "My-Name" }  
}  
}  
}  
}'  
{  
"took" : 3,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 1.0,  
"hits" : [ {  
"\_index" : "whitespace",  
"\_type" : "mytest",  
"\_id" : "2",  
"\_score" : 1.0,  
"\_source":{"hostname":"My-Name"}  
} ]  
}  
}

_Result: OKE_

_Conlusion:_

The Term filter only works on "Not Analysed" fields!  
Is this right?

- Rem:\*  
No errors in de log files.

Luc.

On Mon, Aug 18, 2014 at 3:42 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> I think could help you:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html)
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> 
> Le 18 août 2014 à 15:39:36, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> 
> David hi,
> 
> How can I configure the mapping so that the default analyzer will be the  
> "whitespace" one?
> 
> On Wed, Aug 13, 2014 at 2:46 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> 
> > Having no answer is not good. I think something goes wrong here. May be  
> > you should see something in logs.
> > 
> > That said, if you don't want to break your string as tokens at index  
> > time, you could set index:not\_analyzed for fields you don't want to analyze.
> > 
> > But, you should read this part of the book:  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/analysis-intro.html#analysis-intro)
> > 
> > ```
> > --
> > 
> > ```
> > 
> > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > 
> > Le 13 août 2014 à 14:39:20, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > 
> > I like to use elasticsearch as Nosql database + search engine for data  
> > coming from text files (router configs) and databases .  
> > First I moved a routerconfig to a json file which I indexed .
> > 
> > Mapping:
> > 
> > {  
> > "configs" : {  
> > "mappings" : {  
> > "test" : {  
> > "properties" : {  
> > "ConfLength" : {  
> > "type" : "string"  
> > },  
> > "NVRAM" : {  
> > "type" : "string"  
> > },  
> > "aaa" : {  
> > "type" : "string"  
> > },  
> > "enable" : {  
> > "type" : "string"  
> > },  
> > "hostname" : {  
> > "type" : "string"  
> > },  
> > "lastChange" : {  
> > "type" : "string"  
> > },  
> > "logging" : {  
> > "type" : "string"  
> > },  
> > "model" : {  
> > "type" : "string"  
> > },  
> > "policy-map" : {  
> > "type" : "string"  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > Document:
> > 
> > {  
> > "\_index" : "configs",  
> > "\_type" : "test",  
> > "\_id" : "7",  
> > "\_score" : 1,  
> > "\_source" : {  
> > "hostname" : [  
> > "hostname test-1234"  
> > ]  
> > }  
> > },
> > 
> > Example of a simple search: search a hostname.
> > 
> > _If I start a query_:
> > 
> > _curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)  
> > [http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"hostname test-1234"'_  
> > curl: (52) Empty reply from server
> > 
> > No respone
> > 
> > If I start a second query without hostname if got an answer:
> > 
> > _curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)  
> > [http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"test-1234"'_  
> > OKE
> > 
> > Analyser: standard
> > 
> > Why a search instruction can find "test-1234" but not "hostname  
> > test-1234" ?
> > 
> > --  
> > 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/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%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 a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
> > To unsubscribe from this group and all its topics, 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/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local)  
> > [https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local?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/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.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 a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
> To unsubscribe from this group and all its topics, 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/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local)  
> [https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local?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/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.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: [August 19, 2014, 10:28am UTC](https://discuss.elastic.co/t/query-problem/19253/6 "2014-08-19T10:28:34Z")

</div>

The Term filter only works on "Not Analysed" fields!  
Is this right?

Not exactly.

Term filter is not analyzed. It means that it's compared as is to what you have in the inverted index.

So, for example, if you have indexed in the inverted index "A-B-C", searching with a Term Filter for "a-b-c" won't work.  
"a" won't work as well.

May be you could create a full SENSE recreation which shows your problem so we can replay it and help you?

See [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/help/)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 19 août 2014 à 10:28:15, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:

David,

I made a small example to show you the problem and solution:

1. Index name: whitespace
2. type: mytest

Mapping:

{  
mappings: {  
"mytest": {  
"\_all": { "analyzer": "whitespace" }  
}  
}  
}

Data

{"hostname":["My-Name"]}

Indexing : oke

First Test: Is the analyzer = whitespace oke?

curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q="My"&pretty](http://localhost:9200/whitespace/mytest/_search?q=%22My%22&pretty)'  
{  
"took" : 3,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 0,  
"max\_score" : null,  
"hits" :   
}  
}

Result: OKE

Second Test: Ask complete name

curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q="My-Name"&pretty](http://localhost:9200/whitespace/mytest/_search?q=%22My-Name%22&pretty)'  
{  
"took" : 4,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 0.30685282,  
"hits" : [ {  
"\_index" : "whitespace",  
"\_type" : "mytest",  
"\_id" : "2",  
"\_score" : 0.30685282,  
"\_source":{"hostname":"My-Name"}  
} ]  
}  
}

Result: OKE

Now my problem:

curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search](http://localhost:9200/whitespace/mytest/_search)" -d'

> {  
> "query": {  
> "filtered": {  
> "filter": {  
> "term": { "hostname": "My-Name" }  
> }  
> }  
> }  
> }'  
> {"took":2,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":}}

Because the document was indexed with the whitespace analyzer, he should find "My-Name".

Check Analyzer: OKE  
curl -XGET 'localhost:9200/\_analyze?analyzer=whitespace&pretty&format=text' -d 'My-Name'  
{  
"tokens" : [ {  
"token" : "My-Name",  
"start\_offset" : 0,  
"end\_offset" : 7,  
"type" : "word",  
"position" : 1  
} ]  
}

Test3: not\_analysed Index mapping:

{  
mappings: {  
"mytest": {  
"properties": {  
"hostname": {  
"type": "string",  
"index": "not\_analyzed"  
}  
}  
}  
}

Then:

curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search?pretty](http://localhost:9200/whitespace/mytest/_search?pretty)" -d'  
{  
"query": {  
"filtered": {  
"filter": {  
"term": { "hostname": "My-Name" }  
}  
}  
}  
}'  
{  
"took" : 3,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 1.0,  
"hits" : [ {  
"\_index" : "whitespace",  
"\_type" : "mytest",  
"\_id" : "2",  
"\_score" : 1.0,  
"\_source":{"hostname":"My-Name"}  
} ]  
}  
}

Result: OKE

Conlusion:

The Term filter only works on "Not Analysed" fields!  
Is this right?

Rem:  
No errors in de log files.

Luc.

On Mon, Aug 18, 2014 at 3:42 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
I think could help you: [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 18 août 2014 à 15:39:36, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:

David hi,

How can I configure the mapping so that the default analyzer will be the "whitespace" one?

On Wed, Aug 13, 2014 at 2:46 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
Having no answer is not good. I think something goes wrong here. May be you should see something in logs.

That said, if you don't want to break your string as tokens at index time, you could set index:not\_analyzed for fields you don't want to analyze.

But, you should read this part of the book: [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/analysis-intro.html#analysis-intro)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 13 août 2014 à 14:39:20, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:

I like to use elasticsearch as Nosql database + search engine for data coming from text files (router configs) and databases .  
First I moved a routerconfig to a json file which I indexed .

Mapping:

{  
"configs" : {  
"mappings" : {  
"test" : {  
"properties" : {  
"ConfLength" : {  
"type" : "string"  
},  
"NVRAM" : {  
"type" : "string"  
},  
"aaa" : {  
"type" : "string"  
},  
"enable" : {  
"type" : "string"  
},  
"hostname" : {  
"type" : "string"  
},  
"lastChange" : {  
"type" : "string"  
},  
"logging" : {  
"type" : "string"  
},  
"model" : {  
"type" : "string"  
},  
"policy-map" : {  
"type" : "string"  
}  
}  
}  
}  
}  
}

Document:

{  
"\_index" : "configs",  
"\_type" : "test",  
"\_id" : "7",  
"\_score" : 1,  
"\_source" : {  
"hostname" : [  
"hostname test-1234"  
]  
}  
},

Example of a simple search: search a hostname.

If I start a query:

curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"hostname test-1234"'  
curl: (52) Empty reply from server

No respone

If I start a second query without hostname if got an answer:

curl -XGET '[http://127.0.0.1:9200/configs/\_search?q="test-1234"](http://127.0.0.1:9200/configs/_search?q=%22test-1234%22)'  
OKE

Analyser: standard

Why a search instruction can find "test-1234" but not "hostname test-1234" ?

--  
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/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%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 a topic in the Google Groups "elasticsearch" group.  
To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
To unsubscribe from this group and all its topics, 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/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local).

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/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.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 a topic in the Google Groups "elasticsearch" group.  
To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
To unsubscribe from this group and all its topics, 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/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local).

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/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.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/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Luc\_Evers](https://avatars.discourse-cdn.com/v4/letter/l/aeb1de/32.png) [@Luc\_Evers](https://discuss.elastic.co/u/Luc_Evers)
#### Post date: [August 19, 2014, 11:52am UTC](https://discuss.elastic.co/t/query-problem/19253/7 "2014-08-19T11:52:53Z")

</div>

David,

In my case: "My-Name" why a term filter didn't work on a whitespace  
filter?

Luc.

On Tue, Aug 19, 2014 at 12:28 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> The Term filter only works on "Not Analysed" fields!  
> Is this right?
> 
> Not exactly.
> 
> Term filter is not analyzed. It means that it's compared as is to what you  
> have in the inverted index.
> 
> So, for example, if you have indexed in the inverted index "A-B-C",  
> searching with a Term Filter for "a-b-c" won't work.  
> "a" won't work as well.
> 
> May be you could create a full SENSE recreation which shows your problem  
> so we can replay it and help you?
> 
> See [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/)
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> 
> Le 19 août 2014 à 10:28:15, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> 
> David,
> 
> I made a small example to show you the problem and solution:
> 
> 1. Index name: whitespace
> 2. type: mytest
> 
> _Mapping:_
> 
> {  
> mappings: {  
> "mytest": {  
> "\_all": { "analyzer": "whitespace" }  
> }  
> }  
> }
> 
> _Data_
> 
> {"hostname":["My-Name"]}
> 
> Indexing : oke
> 
> _First Test:_ Is the analyzer = whitespace oke?
> 
> curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q=](http://localhost:9200/whitespace/mytest/_search?q=)  
> "My"&pretty'  
> {  
> "took" : 3,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 0,  
> "max\_score" : null,  
> "hits" :   
> }  
> }
> 
> _Result: OKE_
> 
> _Second Test: Ask complete name_
> 
> curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q=](http://localhost:9200/whitespace/mytest/_search?q=)  
> "My-Name"&pretty'  
> {  
> "took" : 4,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 1,  
> "max\_score" : 0.30685282,  
> "hits" : [ {  
> "\_index" : "whitespace",  
> "\_type" : "mytest",  
> "\_id" : "2",  
> "\_score" : 0.30685282,  
> "\_source":{"hostname":"My-Name"}  
> } ]  
> }  
> }
> 
> _Result: OKE_
> 
> _Now my problem:_
> 
> _curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search](http://localhost:9200/whitespace/mytest/_search)  
> [http://localhost:9200/whitespace/mytest/\_search](http://localhost:9200/whitespace/mytest/_search)" -d'_  
> _\> {_  
> _\> "query": {_  
> _\> "filtered": {_  
> _\> "filter": {_  
> _\> "term": { "hostname": "My-Name" }_  
> \*\> } \*  
> _\> }_  
> _\> }_  
> _\> }'_
> 
> _{"took":2,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":[]}}_
> 
> _Because the document was indexed with the whitespace analyzer, he  
> should find "My-Name"._
> 
> _Check Analyzer: OKE_  
> curl -XGET  
> 'localhost:9200/\_analyze?analyzer=whitespace&pretty&format=text' -d  
> 'My-Name'  
> {  
> "tokens" : [ {  
> "token" : "My-Name",  
> "start\_offset" : 0,  
> "end\_offset" : 7,  
> "type" : "word",  
> "position" : 1  
> } ]  
> }
> 
> _Test3: not\_analysed_ Index mapping:
> 
> {  
> mappings: {  
> "mytest": {  
> "properties": {  
> "hostname": {  
> "type": "string",  
> "index": "not\_analyzed"  
> }  
> }  
> }  
> }
> 
> _Then:_
> 
> curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search?pretty](http://localhost:9200/whitespace/mytest/_search?pretty)" -d'  
> {  
> "query": {  
> "filtered": {  
> "filter": {  
> "term": { "hostname": "My-Name" }  
> }  
> }  
> }  
> }'  
> {  
> "took" : 3,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 1,  
> "max\_score" : 1.0,  
> "hits" : [ {  
> "\_index" : "whitespace",  
> "\_type" : "mytest",  
> "\_id" : "2",  
> "\_score" : 1.0,  
> "\_source":{"hostname":"My-Name"}  
> } ]  
> }  
> }
> 
> _Result: OKE_
> 
> _Conlusion:_
> 
> The Term filter only works on "Not Analysed" fields!  
> Is this right?
> 
> - Rem:\*  
> No errors in de log files.
> 
> Luc.
> 
> On Mon, Aug 18, 2014 at 3:42 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> 
> > I think could help you:  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html)
> > 
> > ```
> > --
> > 
> > ```
> > 
> > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > 
> > Le 18 août 2014 à 15:39:36, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > 
> > David hi,
> > 
> > How can I configure the mapping so that the default analyzer will be  
> > the "whitespace" one?
> > 
> > On Wed, Aug 13, 2014 at 2:46 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > 
> > > Having no answer is not good. I think something goes wrong here. May  
> > > be you should see something in logs.
> > > 
> > > That said, if you don't want to break your string as tokens at index  
> > > time, you could set index:not\_analyzed for fields you don't want to analyze.
> > > 
> > > But, you should read this part of the book:  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/analysis-intro.html#analysis-intro)
> > > 
> > > ```
> > > --
> > > 
> > > ```
> > > 
> > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > 
> > > Le 13 août 2014 à 14:39:20, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > > 
> > > I like to use elasticsearch as Nosql database + search engine for data  
> > > coming from text files (router configs) and databases .  
> > > First I moved a routerconfig to a json file which I indexed .
> > > 
> > > Mapping:
> > > 
> > > {  
> > > "configs" : {  
> > > "mappings" : {  
> > > "test" : {  
> > > "properties" : {  
> > > "ConfLength" : {  
> > > "type" : "string"  
> > > },  
> > > "NVRAM" : {  
> > > "type" : "string"  
> > > },  
> > > "aaa" : {  
> > > "type" : "string"  
> > > },  
> > > "enable" : {  
> > > "type" : "string"  
> > > },  
> > > "hostname" : {  
> > > "type" : "string"  
> > > },  
> > > "lastChange" : {  
> > > "type" : "string"  
> > > },  
> > > "logging" : {  
> > > "type" : "string"  
> > > },  
> > > "model" : {  
> > > "type" : "string"  
> > > },  
> > > "policy-map" : {  
> > > "type" : "string"  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > Document:
> > > 
> > > {  
> > > "\_index" : "configs",  
> > > "\_type" : "test",  
> > > "\_id" : "7",  
> > > "\_score" : 1,  
> > > "\_source" : {  
> > > "hostname" : [  
> > > "hostname test-1234"  
> > > ]  
> > > }  
> > > },
> > > 
> > > Example of a simple search: search a hostname.
> > > 
> > > _If I start a query_:
> > > 
> > > _curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)  
> > > [http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"hostname test-1234"'_  
> > > curl: (52) Empty reply from server
> > > 
> > > No respone
> > > 
> > > If I start a second query without hostname if got an answer:
> > > 
> > > _curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)  
> > > [http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"test-1234"'_  
> > > OKE
> > > 
> > > Analyser: standard
> > > 
> > > Why a search instruction can find "test-1234" but not "hostname  
> > > test-1234" ?
> > > 
> > > --  
> > > 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/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%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 a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
> > > To unsubscribe from this group and all its topics, 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/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local)  
> > > [https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local?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/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.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 a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
> > To unsubscribe from this group and all its topics, 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/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local)  
> > [https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local?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/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.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 a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
> To unsubscribe from this group and all its topics, 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/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local)  
> [https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local?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/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf\_adAKJ5YcXQTTSZD\_51w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf_adAKJ5YcXQTTSZD_51w%40mail.gmail.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: [August 19, 2014, 1:22pm UTC](https://discuss.elastic.co/t/query-problem/19253/8 "2014-08-19T13:22:50Z")

</div>

I have no idea without understanding exactly what you are doing.  
So a SENSE recreation would help a lot.

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 19 août 2014 à 13:53:16, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:

David,

In my case: "My-Name" why a term filter didn't work on a whitespace filter?

Luc.

On Tue, Aug 19, 2014 at 12:28 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
The Term filter only works on "Not Analysed" fields!  
Is this right?

Not exactly.

Term filter is not analyzed. It means that it's compared as is to what you have in the inverted index.

So, for example, if you have indexed in the inverted index "A-B-C", searching with a Term Filter for "a-b-c" won't work.  
"a" won't work as well.

May be you could create a full SENSE recreation which shows your problem so we can replay it and help you?

See [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/help/)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 19 août 2014 à 10:28:15, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:

David,

I made a small example to show you the problem and solution:

1. Index name: whitespace
2. type: mytest

Mapping:

{  
mappings: {  
"mytest": {  
"\_all": { "analyzer": "whitespace" }  
}  
}  
}

Data

{"hostname":["My-Name"]}

Indexing : oke

First Test: Is the analyzer = whitespace oke?

curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q="My"&pretty](http://localhost:9200/whitespace/mytest/_search?q=%22My%22&pretty)'  
{  
"took" : 3,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 0,  
"max\_score" : null,  
"hits" :   
}  
}

Result: OKE

Second Test: Ask complete name

curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q="My-Name"&pretty](http://localhost:9200/whitespace/mytest/_search?q=%22My-Name%22&pretty)'  
{  
"took" : 4,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 0.30685282,  
"hits" : [ {  
"\_index" : "whitespace",  
"\_type" : "mytest",  
"\_id" : "2",  
"\_score" : 0.30685282,  
"\_source":{"hostname":"My-Name"}  
} ]  
}  
}

Result: OKE

Now my problem:

curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search](http://localhost:9200/whitespace/mytest/_search)" -d'

> {  
> "query": {  
> "filtered": {  
> "filter": {  
> "term": { "hostname": "My-Name" }  
> }  
> }  
> }  
> }'  
> {"took":2,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":}}

Because the document was indexed with the whitespace analyzer, he should find "My-Name".

Check Analyzer: OKE  
curl -XGET 'localhost:9200/\_analyze?analyzer=whitespace&pretty&format=text' -d 'My-Name'  
{  
"tokens" : [ {  
"token" : "My-Name",  
"start\_offset" : 0,  
"end\_offset" : 7,  
"type" : "word",  
"position" : 1  
} ]  
}

Test3: not\_analysed Index mapping:

{  
mappings: {  
"mytest": {  
"properties": {  
"hostname": {  
"type": "string",  
"index": "not\_analyzed"  
}  
}  
}  
}

Then:

curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search?pretty](http://localhost:9200/whitespace/mytest/_search?pretty)" -d'  
{  
"query": {  
"filtered": {  
"filter": {  
"term": { "hostname": "My-Name" }  
}  
}  
}  
}'  
{  
"took" : 3,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 1.0,  
"hits" : [ {  
"\_index" : "whitespace",  
"\_type" : "mytest",  
"\_id" : "2",  
"\_score" : 1.0,  
"\_source":{"hostname":"My-Name"}  
} ]  
}  
}

Result: OKE

Conlusion:

The Term filter only works on "Not Analysed" fields!  
Is this right?

Rem:  
No errors in de log files.

Luc.

On Mon, Aug 18, 2014 at 3:42 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
I think could help you: [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 18 août 2014 à 15:39:36, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:

David hi,

How can I configure the mapping so that the default analyzer will be the "whitespace" one?

On Wed, Aug 13, 2014 at 2:46 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
Having no answer is not good. I think something goes wrong here. May be you should see something in logs.

That said, if you don't want to break your string as tokens at index time, you could set index:not\_analyzed for fields you don't want to analyze.

But, you should read this part of the book: [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/analysis-intro.html#analysis-intro)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 13 août 2014 à 14:39:20, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:

I like to use elasticsearch as Nosql database + search engine for data coming from text files (router configs) and databases .  
First I moved a routerconfig to a json file which I indexed .

Mapping:

{  
"configs" : {  
"mappings" : {  
"test" : {  
"properties" : {  
"ConfLength" : {  
"type" : "string"  
},  
"NVRAM" : {  
"type" : "string"  
},  
"aaa" : {  
"type" : "string"  
},  
"enable" : {  
"type" : "string"  
},  
"hostname" : {  
"type" : "string"  
},  
"lastChange" : {  
"type" : "string"  
},  
"logging" : {  
"type" : "string"  
},  
"model" : {  
"type" : "string"  
},  
"policy-map" : {  
"type" : "string"  
}  
}  
}  
}  
}  
}

Document:

{  
"\_index" : "configs",  
"\_type" : "test",  
"\_id" : "7",  
"\_score" : 1,  
"\_source" : {  
"hostname" : [  
"hostname test-1234"  
]  
}  
},

Example of a simple search: search a hostname.

If I start a query:

curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"hostname test-1234"'  
curl: (52) Empty reply from server

No respone

If I start a second query without hostname if got an answer:

curl -XGET '[http://127.0.0.1:9200/configs/\_search?q="test-1234"](http://127.0.0.1:9200/configs/_search?q=%22test-1234%22)'  
OKE

Analyser: standard

Why a search instruction can find "test-1234" but not "hostname test-1234" ?

--  
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/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%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 a topic in the Google Groups "elasticsearch" group.  
To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
To unsubscribe from this group and all its topics, 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/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local).

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/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.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 a topic in the Google Groups "elasticsearch" group.  
To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
To unsubscribe from this group and all its topics, 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/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local).

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/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.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 a topic in the Google Groups "elasticsearch" group.  
To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
To unsubscribe from this group and all its topics, 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/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local).

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/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf\_adAKJ5YcXQTTSZD\_51w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf_adAKJ5YcXQTTSZD_51w%40mail.gmail.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/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Luc\_Evers](https://avatars.discourse-cdn.com/v4/letter/l/aeb1de/32.png) [@Luc\_Evers](https://discuss.elastic.co/u/Luc_Evers)
#### Post date: [August 19, 2014, 5:53pm UTC](https://discuss.elastic.co/t/query-problem/19253/9 "2014-08-19T17:53:30Z")

</div>

David,

- I have a very simple example:\*

1. Below the data file "configs.json"

{"hostname":["My-Name"]}

1. the mapping file: "_\_configs.json"_

{

> ```
> mappings: {
> "mytest": {
> "_all": { "analyzer": "whitespace" }
> }
> 
> ```
> 
> }  
> }

Thats All

Index the 'configs.json' with the mapping '\_configs.json'

1. Send a search request:

_Sense example_

POST /whitespace/mytest/\_search  
{  
"query": {  
"filtered": {  
"filter": {  
"term": { "hostname": "My-Name" }  
}  
}  
}  
}

This example shall fail if the analyser is "whitespace".  
If you don't analyse ("not\_analyzed") the example shall work.  
Because the whitespace analyser don't split the string "My-Name", the test  
should work!

Rem  
The index name "whitespace" is only done for remembering which test is  
which index.

Luc.

On Tue, Aug 19, 2014 at 3:22 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> I have no idea without understanding exactly what you are doing.  
> So a SENSE recreation would help a lot.
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> 
> Le 19 août 2014 à 13:53:16, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> 
> David,
> 
> In my case: "My-Name" why a term filter didn't work on a whitespace  
> filter?
> 
> Luc.
> 
> On Tue, Aug 19, 2014 at 12:28 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> 
> > ```
> > The Term filter only works on "Not Analysed" fields!
> > 
> > ```
> > 
> > Is this right?
> > 
> > Not exactly.
> > 
> > Term filter is not analyzed. It means that it's compared as is to what  
> > you have in the inverted index.
> > 
> > So, for example, if you have indexed in the inverted index "A-B-C",  
> > searching with a Term Filter for "a-b-c" won't work.  
> > "a" won't work as well.
> > 
> > May be you could create a full SENSE recreation which shows your problem  
> > so we can replay it and help you?
> > 
> > See [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/)
> > 
> > ```
> > --
> > 
> > ```
> > 
> > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > 
> > Le 19 août 2014 à 10:28:15, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > 
> > David,
> > 
> > I made a small example to show you the problem and solution:
> > 
> > 1. Index name: whitespace
> > 2. type: mytest
> > 
> > _Mapping:_
> > 
> > {  
> > mappings: {  
> > "mytest": {  
> > "\_all": { "analyzer": "whitespace" }  
> > }  
> > }  
> > }
> > 
> > _Data_
> > 
> > {"hostname":["My-Name"]}
> > 
> > Indexing : oke
> > 
> > _First Test:_ Is the analyzer = whitespace oke?
> > 
> > curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q=](http://localhost:9200/whitespace/mytest/_search?q=)  
> > "My"&pretty'  
> > {  
> > "took" : 3,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 0,  
> > "max\_score" : null,  
> > "hits" :   
> > }  
> > }
> > 
> > _Result: OKE_
> > 
> > _Second Test: Ask complete name_
> > 
> > curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q=](http://localhost:9200/whitespace/mytest/_search?q=)  
> > "My-Name"&pretty'  
> > {  
> > "took" : 4,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 1,  
> > "max\_score" : 0.30685282,  
> > "hits" : [ {  
> > "\_index" : "whitespace",  
> > "\_type" : "mytest",  
> > "\_id" : "2",  
> > "\_score" : 0.30685282,  
> > "\_source":{"hostname":"My-Name"}  
> > } ]  
> > }  
> > }
> > 
> > _Result: OKE_
> > 
> > _Now my problem:_
> > 
> > _curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search](http://localhost:9200/whitespace/mytest/_search)  
> > [http://localhost:9200/whitespace/mytest/\_search](http://localhost:9200/whitespace/mytest/_search)" -d'_  
> > _\> {_  
> > _\> "query": {_  
> > _\> "filtered": {_  
> > _\> "filter": {_  
> > _\> "term": { "hostname": "My-Name" }_  
> > \*\> } \*  
> > _\> }_  
> > _\> }_  
> > _\> }'_
> > 
> > _{"took":2,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":[]}}_
> > 
> > _Because the document was indexed with the whitespace analyzer, he  
> > should find "My-Name"._
> > 
> > _Check Analyzer: OKE_  
> > curl -XGET  
> > 'localhost:9200/\_analyze?analyzer=whitespace&pretty&format=text' -d  
> > 'My-Name'  
> > {  
> > "tokens" : [ {  
> > "token" : "My-Name",  
> > "start\_offset" : 0,  
> > "end\_offset" : 7,  
> > "type" : "word",  
> > "position" : 1  
> > } ]  
> > }
> > 
> > _Test3: not\_analysed_ Index mapping:
> > 
> > {  
> > mappings: {  
> > "mytest": {  
> > "properties": {  
> > "hostname": {  
> > "type": "string",  
> > "index": "not\_analyzed"  
> > }  
> > }  
> > }  
> > }
> > 
> > _Then:_
> > 
> > curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search?pretty](http://localhost:9200/whitespace/mytest/_search?pretty)" -d'  
> > {  
> > "query": {  
> > "filtered": {  
> > "filter": {  
> > "term": { "hostname": "My-Name" }  
> > }  
> > }  
> > }  
> > }'  
> > {  
> > "took" : 3,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 1,  
> > "max\_score" : 1.0,  
> > "hits" : [ {  
> > "\_index" : "whitespace",  
> > "\_type" : "mytest",  
> > "\_id" : "2",  
> > "\_score" : 1.0,  
> > "\_source":{"hostname":"My-Name"}  
> > } ]  
> > }  
> > }
> > 
> > _Result: OKE_
> > 
> > _Conlusion:_
> > 
> > The Term filter only works on "Not Analysed" fields!  
> > Is this right?
> > 
> > - Rem:\*  
> > No errors in de log files.
> > 
> > Luc.
> > 
> > On Mon, Aug 18, 2014 at 3:42 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > 
> > > I think could help you:  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html)
> > > 
> > > ```
> > > --
> > > 
> > > ```
> > > 
> > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > 
> > > Le 18 août 2014 à 15:39:36, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > > 
> > > David hi,
> > > 
> > > How can I configure the mapping so that the default analyzer will be  
> > > the "whitespace" one?
> > > 
> > > On Wed, Aug 13, 2014 at 2:46 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > 
> > > > Having no answer is not good. I think something goes wrong here. May  
> > > > be you should see something in logs.
> > > > 
> > > > That said, if you don't want to break your string as tokens at index  
> > > > time, you could set index:not\_analyzed for fields you don't want to analyze.
> > > > 
> > > > But, you should read this part of the book:  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/analysis-intro.html#analysis-intro)
> > > > 
> > > > ```
> > > > --
> > > > 
> > > > ```
> > > > 
> > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > > 
> > > > Le 13 août 2014 à 14:39:20, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > > > 
> > > > I like to use elasticsearch as Nosql database + search engine for  
> > > > data coming from text files (router configs) and databases .  
> > > > First I moved a routerconfig to a json file which I indexed .
> > > > 
> > > > Mapping:
> > > > 
> > > > {  
> > > > "configs" : {  
> > > > "mappings" : {  
> > > > "test" : {  
> > > > "properties" : {  
> > > > "ConfLength" : {  
> > > > "type" : "string"  
> > > > },  
> > > > "NVRAM" : {  
> > > > "type" : "string"  
> > > > },  
> > > > "aaa" : {  
> > > > "type" : "string"  
> > > > },  
> > > > "enable" : {  
> > > > "type" : "string"  
> > > > },  
> > > > "hostname" : {  
> > > > "type" : "string"  
> > > > },  
> > > > "lastChange" : {  
> > > > "type" : "string"  
> > > > },  
> > > > "logging" : {  
> > > > "type" : "string"  
> > > > },  
> > > > "model" : {  
> > > > "type" : "string"  
> > > > },  
> > > > "policy-map" : {  
> > > > "type" : "string"  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > Document:
> > > > 
> > > > {  
> > > > "\_index" : "configs",  
> > > > "\_type" : "test",  
> > > > "\_id" : "7",  
> > > > "\_score" : 1,  
> > > > "\_source" : {  
> > > > "hostname" : [  
> > > > "hostname test-1234"  
> > > > ]  
> > > > }  
> > > > },
> > > > 
> > > > Example of a simple search: search a hostname.
> > > > 
> > > > _If I start a query_:
> > > > 
> > > > _curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)  
> > > > [http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"hostname test-1234"'_  
> > > > curl: (52) Empty reply from server
> > > > 
> > > > No respone
> > > > 
> > > > If I start a second query without hostname if got an answer:
> > > > 
> > > > _curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)  
> > > > [http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"test-1234"'_  
> > > > OKE
> > > > 
> > > > Analyser: standard
> > > > 
> > > > Why a search instruction can find "test-1234" but not "hostname  
> > > > test-1234" ?
> > > > 
> > > > --  
> > > > 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/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%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 a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit  
> > > > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, 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/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local?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/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.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 a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
> > > To unsubscribe from this group and all its topics, 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/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local)  
> > > [https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local?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/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.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 a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
> > To unsubscribe from this group and all its topics, 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/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local)  
> > [https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local?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/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf\_adAKJ5YcXQTTSZD\_51w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf_adAKJ5YcXQTTSZD_51w%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf\_adAKJ5YcXQTTSZD\_51w%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf_adAKJ5YcXQTTSZD_51w%40mail.gmail.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 a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
> To unsubscribe from this group and all its topics, 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/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local)  
> [https://groups.google.com/d/msgid/elasticsearch/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local?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/CAA0yNqJp1B0fGvQgJJKkx\_1%3DMmDWH\_ALt36B6JSRaNejhRMUag%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJp1B0fGvQgJJKkx_1%3DMmDWH_ALt36B6JSRaNejhRMUag%40mail.gmail.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: [August 19, 2014, 7:10pm UTC](https://discuss.elastic.co/t/query-problem/19253/10 "2014-08-19T19:10:05Z")

</div>

You are searching in hostname field not in \_all. I think that's your problem here.

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 19 août 2014 à 19:53:53, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:

David,

I have a very simple example:

1. Below the data file "configs.json"

{"hostname":["My-Name"]}

1. the mapping file: "\_configs.json"  
{  
mappings: {  
"mytest": {  
"\_all": { "analyzer": "whitespace" }  
}  
}  
}

Thats All

Index the 'configs.json' with the mapping '\_configs.json'  
3) Send a search request:

Sense example

POST /whitespace/mytest/\_search  
{  
"query": {  
"filtered": {  
"filter": {  
"term": { "hostname": "My-Name" }  
}  
}  
}  
}

This example shall fail if the analyser is "whitespace".  
If you don't analyse ("not\_analyzed") the example shall work.  
Because the whitespace analyser don't split the string "My-Name", the test should work!

Rem  
The index name "whitespace" is only done for remembering which test is which index.

Luc.

On Tue, Aug 19, 2014 at 3:22 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
I have no idea without understanding exactly what you are doing.  
So a SENSE recreation would help a lot.

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 19 août 2014 à 13:53:16, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:

David,

In my case: "My-Name" why a term filter didn't work on a whitespace filter?

Luc.

On Tue, Aug 19, 2014 at 12:28 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
The Term filter only works on "Not Analysed" fields!  
Is this right?

Not exactly.

Term filter is not analyzed. It means that it's compared as is to what you have in the inverted index.

So, for example, if you have indexed in the inverted index "A-B-C", searching with a Term Filter for "a-b-c" won't work.  
"a" won't work as well.

May be you could create a full SENSE recreation which shows your problem so we can replay it and help you?

See [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/help/)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 19 août 2014 à 10:28:15, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:

David,

I made a small example to show you the problem and solution:

1. Index name: whitespace
2. type: mytest

Mapping:

{  
mappings: {  
"mytest": {  
"\_all": { "analyzer": "whitespace" }  
}  
}  
}

Data

{"hostname":["My-Name"]}

Indexing : oke

First Test: Is the analyzer = whitespace oke?

curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q="My"&pretty](http://localhost:9200/whitespace/mytest/_search?q=%22My%22&pretty)'  
{  
"took" : 3,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 0,  
"max\_score" : null,  
"hits" :   
}  
}

Result: OKE

Second Test: Ask complete name

curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q="My-Name"&pretty](http://localhost:9200/whitespace/mytest/_search?q=%22My-Name%22&pretty)'  
{  
"took" : 4,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 0.30685282,  
"hits" : [ {  
"\_index" : "whitespace",  
"\_type" : "mytest",  
"\_id" : "2",  
"\_score" : 0.30685282,  
"\_source":{"hostname":"My-Name"}  
} ]  
}  
}

Result: OKE

Now my problem:

curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search](http://localhost:9200/whitespace/mytest/_search)" -d'

> {  
> "query": {  
> "filtered": {  
> "filter": {  
> "term": { "hostname": "My-Name" }  
> }  
> }  
> }  
> }'  
> {"took":2,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":}}

Because the document was indexed with the whitespace analyzer, he should find "My-Name".

Check Analyzer: OKE  
curl -XGET 'localhost:9200/\_analyze?analyzer=whitespace&pretty&format=text' -d 'My-Name'  
{  
"tokens" : [ {  
"token" : "My-Name",  
"start\_offset" : 0,  
"end\_offset" : 7,  
"type" : "word",  
"position" : 1  
} ]  
}

Test3: not\_analysed Index mapping:

{  
mappings: {  
"mytest": {  
"properties": {  
"hostname": {  
"type": "string",  
"index": "not\_analyzed"  
}  
}  
}  
}

Then:

curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search?pretty](http://localhost:9200/whitespace/mytest/_search?pretty)" -d'  
{  
"query": {  
"filtered": {  
"filter": {  
"term": { "hostname": "My-Name" }  
}  
}  
}  
}'  
{  
"took" : 3,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 1.0,  
"hits" : [ {  
"\_index" : "whitespace",  
"\_type" : "mytest",  
"\_id" : "2",  
"\_score" : 1.0,  
"\_source":{"hostname":"My-Name"}  
} ]  
}  
}

Result: OKE

Conlusion:

The Term filter only works on "Not Analysed" fields!  
Is this right?

Rem:  
No errors in de log files.

Luc.

On Mon, Aug 18, 2014 at 3:42 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
I think could help you: [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 18 août 2014 à 15:39:36, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:

David hi,

How can I configure the mapping so that the default analyzer will be the "whitespace" one?

On Wed, Aug 13, 2014 at 2:46 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
Having no answer is not good. I think something goes wrong here. May be you should see something in logs.

That said, if you don't want to break your string as tokens at index time, you could set index:not\_analyzed for fields you don't want to analyze.

But, you should read this part of the book: [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/analysis-intro.html#analysis-intro)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 13 août 2014 à 14:39:20, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:

I like to use elasticsearch as Nosql database + search engine for data coming from text files (router configs) and databases .  
First I moved a routerconfig to a json file which I indexed .

Mapping:

{  
"configs" : {  
"mappings" : {  
"test" : {  
"properties" : {  
"ConfLength" : {  
"type" : "string"  
},  
"NVRAM" : {  
"type" : "string"  
},  
"aaa" : {  
"type" : "string"  
},  
"enable" : {  
"type" : "string"  
},  
"hostname" : {  
"type" : "string"  
},  
"lastChange" : {  
"type" : "string"  
},  
"logging" : {  
"type" : "string"  
},  
"model" : {  
"type" : "string"  
},  
"policy-map" : {  
"type" : "string"  
}  
}  
}  
}  
}  
}

Document:

{  
"\_index" : "configs",  
"\_type" : "test",  
"\_id" : "7",  
"\_score" : 1,  
"\_source" : {  
"hostname" : [  
"hostname test-1234"  
]  
}  
},

Example of a simple search: search a hostname.

If I start a query:

curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"hostname test-1234"'  
curl: (52) Empty reply from server

No respone

If I start a second query without hostname if got an answer:

curl -XGET '[http://127.0.0.1:9200/configs/\_search?q="test-1234"](http://127.0.0.1:9200/configs/_search?q=%22test-1234%22)'  
OKE

Analyser: standard

Why a search instruction can find "test-1234" but not "hostname test-1234" ?

--  
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/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%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 a topic in the Google Groups "elasticsearch" group.  
To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
To unsubscribe from this group and all its topics, 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/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local).

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/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.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 a topic in the Google Groups "elasticsearch" group.  
To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
To unsubscribe from this group and all its topics, 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/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local).

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/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.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 a topic in the Google Groups "elasticsearch" group.  
To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
To unsubscribe from this group and all its topics, 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/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local).

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/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf\_adAKJ5YcXQTTSZD\_51w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf_adAKJ5YcXQTTSZD_51w%40mail.gmail.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 a topic in the Google Groups "elasticsearch" group.  
To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
To unsubscribe from this group and all its topics, 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/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local).

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/CAA0yNqJp1B0fGvQgJJKkx\_1%3DMmDWH\_ALt36B6JSRaNejhRMUag%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJp1B0fGvQgJJKkx_1%3DMmDWH_ALt36B6JSRaNejhRMUag%40mail.gmail.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/etPan.53f3a10e.1d4ed43b.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f3a10e.1d4ed43b.132%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Luc\_Evers](https://avatars.discourse-cdn.com/v4/letter/l/aeb1de/32.png) [@Luc\_Evers](https://discuss.elastic.co/u/Luc_Evers)
#### Post date: [August 20, 2014, 6:03am UTC](https://discuss.elastic.co/t/query-problem/19253/11 "2014-08-20T06:03:06Z")

</div>

The \_all field is a special field:

The \_all field allows us to create a field where the contents of other  
fields will  
be copied as well...

I shall test further and shall find out the problem, thanks for help !

On Tue, Aug 19, 2014 at 9:10 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> You are searching in hostname field not in \_all. I think that's your  
> problem here.
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> 
> Le 19 août 2014 à 19:53:53, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> 
> David,
> 
> - I have a very simple example:\*
> 
> 1. Below the data file "configs.json"
> 
> {"hostname":["My-Name"]}
> 
> 1. the mapping file: "_\_configs.json"_
> 
> > ```
> > mappings: {
> > "mytest": {
> > "_all": { "analyzer": "whitespace" }
> > }
> > 
> > ```
> > 
> > }  
> > }
> 
> Thats All
> 
> Index the 'configs.json' with the mapping '\_configs.json'
> 
> 1. Send a search request:
> 
> _Sense example_
> 
> POST /whitespace/mytest/\_search  
> {  
> "query": {  
> "filtered": {  
> "filter": {  
> "term": { "hostname": "My-Name" }  
> }  
> }  
> }  
> }
> 
> This example shall fail if the analyser is "whitespace".  
> If you don't analyse ("not\_analyzed") the example shall work.  
> Because the whitespace analyser don't split the string "My-Name", the test  
> should work!
> 
> Rem  
> The index name "whitespace" is only done for remembering which test is  
> which index.
> 
> Luc.
> 
> On Tue, Aug 19, 2014 at 3:22 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> 
> > I have no idea without understanding exactly what you are doing.  
> > So a SENSE recreation would help a lot.
> > 
> > ```
> > --
> > 
> > ```
> > 
> > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > 
> > Le 19 août 2014 à 13:53:16, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > 
> > David,
> > 
> > In my case: "My-Name" why a term filter didn't work on a whitespace  
> > filter?
> > 
> > Luc.
> > 
> > On Tue, Aug 19, 2014 at 12:28 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > 
> > > ```
> > > The Term filter only works on "Not Analysed" fields!
> > > 
> > > ```
> > > 
> > > Is this right?
> > > 
> > > Not exactly.
> > > 
> > > Term filter is not analyzed. It means that it's compared as is to what  
> > > you have in the inverted index.
> > > 
> > > So, for example, if you have indexed in the inverted index "A-B-C",  
> > > searching with a Term Filter for "a-b-c" won't work.  
> > > "a" won't work as well.
> > > 
> > > May be you could create a full SENSE recreation which shows your problem  
> > > so we can replay it and help you?
> > > 
> > > See [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/)
> > > 
> > > ```
> > > --
> > > 
> > > ```
> > > 
> > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > 
> > > Le 19 août 2014 à 10:28:15, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > > 
> > > David,
> > > 
> > > I made a small example to show you the problem and solution:
> > > 
> > > 1. Index name: whitespace
> > > 2. type: mytest
> > > 
> > > _Mapping:_
> > > 
> > > {  
> > > mappings: {  
> > > "mytest": {  
> > > "\_all": { "analyzer": "whitespace" }  
> > > }  
> > > }  
> > > }
> > > 
> > > _Data_
> > > 
> > > {"hostname":["My-Name"]}
> > > 
> > > Indexing : oke
> > > 
> > > _First Test:_ Is the analyzer = whitespace oke?
> > > 
> > > curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q=](http://localhost:9200/whitespace/mytest/_search?q=)  
> > > "My"&pretty'  
> > > {  
> > > "took" : 3,  
> > > "timed\_out" : false,  
> > > "\_shards" : {  
> > > "total" : 5,  
> > > "successful" : 5,  
> > > "failed" : 0  
> > > },  
> > > "hits" : {  
> > > "total" : 0,  
> > > "max\_score" : null,  
> > > "hits" :   
> > > }  
> > > }
> > > 
> > > _Result: OKE_
> > > 
> > > _Second Test: Ask complete name_
> > > 
> > > curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q=](http://localhost:9200/whitespace/mytest/_search?q=)  
> > > "My-Name"&pretty'  
> > > {  
> > > "took" : 4,  
> > > "timed\_out" : false,  
> > > "\_shards" : {  
> > > "total" : 5,  
> > > "successful" : 5,  
> > > "failed" : 0  
> > > },  
> > > "hits" : {  
> > > "total" : 1,  
> > > "max\_score" : 0.30685282,  
> > > "hits" : [ {  
> > > "\_index" : "whitespace",  
> > > "\_type" : "mytest",  
> > > "\_id" : "2",  
> > > "\_score" : 0.30685282,  
> > > "\_source":{"hostname":"My-Name"}  
> > > } ]  
> > > }  
> > > }
> > > 
> > > _Result: OKE_
> > > 
> > > _Now my problem:_
> > > 
> > > _curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search](http://localhost:9200/whitespace/mytest/_search)  
> > > [http://localhost:9200/whitespace/mytest/\_search](http://localhost:9200/whitespace/mytest/_search)" -d'_  
> > > _\> {_  
> > > _\> "query": {_  
> > > _\> "filtered": {_  
> > > _\> "filter": {_  
> > > _\> "term": { "hostname": "My-Name" }_  
> > > \*\> } \*  
> > > _\> }_  
> > > _\> }_  
> > > _\> }'_
> > > 
> > > _{"took":2,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":[]}}_
> > > 
> > > _Because the document was indexed with the whitespace analyzer, he  
> > > should find "My-Name"._
> > > 
> > > _Check Analyzer: OKE_  
> > > curl -XGET  
> > > 'localhost:9200/\_analyze?analyzer=whitespace&pretty&format=text' -d  
> > > 'My-Name'  
> > > {  
> > > "tokens" : [ {  
> > > "token" : "My-Name",  
> > > "start\_offset" : 0,  
> > > "end\_offset" : 7,  
> > > "type" : "word",  
> > > "position" : 1  
> > > } ]  
> > > }
> > > 
> > > _Test3: not\_analysed_ Index mapping:
> > > 
> > > {  
> > > mappings: {  
> > > "mytest": {  
> > > "properties": {  
> > > "hostname": {  
> > > "type": "string",  
> > > "index": "not\_analyzed"  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > _Then:_
> > > 
> > > curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search?pretty](http://localhost:9200/whitespace/mytest/_search?pretty)"  
> > > -d'  
> > > {  
> > > "query": {  
> > > "filtered": {  
> > > "filter": {  
> > > "term": { "hostname": "My-Name" }  
> > > }  
> > > }  
> > > }  
> > > }'  
> > > {  
> > > "took" : 3,  
> > > "timed\_out" : false,  
> > > "\_shards" : {  
> > > "total" : 5,  
> > > "successful" : 5,  
> > > "failed" : 0  
> > > },  
> > > "hits" : {  
> > > "total" : 1,  
> > > "max\_score" : 1.0,  
> > > "hits" : [ {  
> > > "\_index" : "whitespace",  
> > > "\_type" : "mytest",  
> > > "\_id" : "2",  
> > > "\_score" : 1.0,  
> > > "\_source":{"hostname":"My-Name"}  
> > > } ]  
> > > }  
> > > }
> > > 
> > > _Result: OKE_
> > > 
> > > _Conlusion:_
> > > 
> > > The Term filter only works on "Not Analysed" fields!  
> > > Is this right?
> > > 
> > > - Rem:\*  
> > > No errors in de log files.
> > > 
> > > Luc.
> > > 
> > > On Mon, Aug 18, 2014 at 3:42 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > 
> > > > I think could help you:  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html)
> > > > 
> > > > ```
> > > > --
> > > > 
> > > > ```
> > > > 
> > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > > 
> > > > Le 18 août 2014 à 15:39:36, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > > > 
> > > > David hi,
> > > > 
> > > > How can I configure the mapping so that the default analyzer will be  
> > > > the "whitespace" one?
> > > > 
> > > > On Wed, Aug 13, 2014 at 2:46 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > > 
> > > > > Having no answer is not good. I think something goes wrong here. May  
> > > > > be you should see something in logs.
> > > > > 
> > > > > That said, if you don't want to break your string as tokens at index  
> > > > > time, you could set index:not\_analyzed for fields you don't want to analyze.
> > > > > 
> > > > > But, you should read this part of the book:  
> > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/analysis-intro.html#analysis-intro)
> > > > > 
> > > > > ```
> > > > > --
> > > > > 
> > > > > ```
> > > > > 
> > > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > > > 
> > > > > Le 13 août 2014 à 14:39:20, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > > > > 
> > > > > I like to use elasticsearch as Nosql database + search engine for  
> > > > > data coming from text files (router configs) and databases .  
> > > > > First I moved a routerconfig to a json file which I indexed .
> > > > > 
> > > > > Mapping:
> > > > > 
> > > > > {  
> > > > > "configs" : {  
> > > > > "mappings" : {  
> > > > > "test" : {  
> > > > > "properties" : {  
> > > > > "ConfLength" : {  
> > > > > "type" : "string"  
> > > > > },  
> > > > > "NVRAM" : {  
> > > > > "type" : "string"  
> > > > > },  
> > > > > "aaa" : {  
> > > > > "type" : "string"  
> > > > > },  
> > > > > "enable" : {  
> > > > > "type" : "string"  
> > > > > },  
> > > > > "hostname" : {  
> > > > > "type" : "string"  
> > > > > },  
> > > > > "lastChange" : {  
> > > > > "type" : "string"  
> > > > > },  
> > > > > "logging" : {  
> > > > > "type" : "string"  
> > > > > },  
> > > > > "model" : {  
> > > > > "type" : "string"  
> > > > > },  
> > > > > "policy-map" : {  
> > > > > "type" : "string"  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }
> > > > > 
> > > > > Document:
> > > > > 
> > > > > {  
> > > > > "\_index" : "configs",  
> > > > > "\_type" : "test",  
> > > > > "\_id" : "7",  
> > > > > "\_score" : 1,  
> > > > > "\_source" : {  
> > > > > "hostname" : [  
> > > > > "hostname test-1234"  
> > > > > ]  
> > > > > }  
> > > > > },
> > > > > 
> > > > > Example of a simple search: search a hostname.
> > > > > 
> > > > > _If I start a query_:
> > > > > 
> > > > > _curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)  
> > > > > [http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"hostname test-1234"'_  
> > > > > curl: (52) Empty reply from server
> > > > > 
> > > > > No respone
> > > > > 
> > > > > If I start a second query without hostname if got an answer:
> > > > > 
> > > > > _curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)  
> > > > > [http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"test-1234"'_  
> > > > > OKE
> > > > > 
> > > > > Analyser: standard
> > > > > 
> > > > > Why a search instruction can find "test-1234" but not "hostname  
> > > > > test-1234" ?
> > > > > 
> > > > > --  
> > > > > 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/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%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 a topic in the  
> > > > > Google Groups "elasticsearch" group.  
> > > > > To unsubscribe from this topic, visit  
> > > > > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe)  
> > > > > .  
> > > > > To unsubscribe from this group and all its topics, 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/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local?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/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.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 a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit  
> > > > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, 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/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local?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/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.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 a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
> > > To unsubscribe from this group and all its topics, 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/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local)  
> > > [https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local?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/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf\_adAKJ5YcXQTTSZD\_51w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf_adAKJ5YcXQTTSZD_51w%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf\_adAKJ5YcXQTTSZD\_51w%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf_adAKJ5YcXQTTSZD_51w%40mail.gmail.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 a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
> > To unsubscribe from this group and all its topics, 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/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local)  
> > [https://groups.google.com/d/msgid/elasticsearch/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local?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/CAA0yNqJp1B0fGvQgJJKkx\_1%3DMmDWH\_ALt36B6JSRaNejhRMUag%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJp1B0fGvQgJJKkx_1%3DMmDWH_ALt36B6JSRaNejhRMUag%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJp1B0fGvQgJJKkx\_1%3DMmDWH\_ALt36B6JSRaNejhRMUag%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJp1B0fGvQgJJKkx_1%3DMmDWH_ALt36B6JSRaNejhRMUag%40mail.gmail.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 a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
> To unsubscribe from this group and all its topics, 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/etPan.53f3a10e.1d4ed43b.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f3a10e.1d4ed43b.132%40MacBook-Air-de-David.local)  
> [https://groups.google.com/d/msgid/elasticsearch/etPan.53f3a10e.1d4ed43b.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f3a10e.1d4ed43b.132%40MacBook-Air-de-David.local?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/CAA0yNqJ4FDsjFBYm0mvoTOwuCNHZmdJK%3DEP3UXQc5FppM%2BsrwQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJ4FDsjFBYm0mvoTOwuCNHZmdJK%3DEP3UXQc5FppM%2BsrwQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Luc\_Evers](https://avatars.discourse-cdn.com/v4/letter/l/aeb1de/32.png) [@Luc\_Evers](https://discuss.elastic.co/u/Luc_Evers)
#### Post date: [August 20, 2014, 12:12pm UTC](https://discuss.elastic.co/t/query-problem/19253/12 "2014-08-20T12:12:14Z")

</div>

For Info

Problem caused due to a wrong mapping configuration.

This one solved my problem:

{  
mappings: {  
"mytest" : {  
"index\_analyzer" : "whitespace"  
}  
}  
}

On Wed, Aug 20, 2014 at 8:03 AM, Luc Evers [lucevers@gmail.com](mailto:lucevers@gmail.com) wrote:

> The \_all field is a special field:
> 
> The \_all field allows us to create a field where the contents of other  
> fields will  
> be copied as well...
> 
> I shall test further and shall find out the problem, thanks for help !
> 
> On Tue, Aug 19, 2014 at 9:10 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> 
> > You are searching in hostname field not in \_all. I think that's your  
> > problem here.
> > 
> > --  
> > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > 
> > Le 19 août 2014 à 19:53:53, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > 
> > David,
> > 
> > - I have a very simple example:\*
> > 
> > 1. Below the data file "configs.json"
> > 
> > {"hostname":["My-Name"]}
> > 
> > 1. the mapping file: "_\_configs.json"_
> > 
> > > ```
> > > mappings: {
> > > "mytest": {
> > > "_all": { "analyzer": "whitespace" }
> > > }
> > > 
> > > ```
> > > 
> > > }  
> > > }
> > 
> > Thats All
> > 
> > Index the 'configs.json' with the mapping '\_configs.json'
> > 
> > 1. Send a search request:
> > 
> > _Sense example_
> > 
> > POST /whitespace/mytest/\_search  
> > {  
> > "query": {  
> > "filtered": {  
> > "filter": {  
> > "term": { "hostname": "My-Name" }  
> > }  
> > }  
> > }  
> > }
> > 
> > This example shall fail if the analyser is "whitespace".  
> > If you don't analyse ("not\_analyzed") the example shall work.  
> > Because the whitespace analyser don't split the string "My-Name", the  
> > test should work!
> > 
> > Rem  
> > The index name "whitespace" is only done for remembering which test is  
> > which index.
> > 
> > Luc.
> > 
> > On Tue, Aug 19, 2014 at 3:22 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > 
> > > I have no idea without understanding exactly what you are doing.  
> > > So a SENSE recreation would help a lot.
> > > 
> > > ```
> > > --
> > > 
> > > ```
> > > 
> > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > 
> > > Le 19 août 2014 à 13:53:16, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > > 
> > > David,
> > > 
> > > In my case: "My-Name" why a term filter didn't work on a whitespace  
> > > filter?
> > > 
> > > Luc.
> > > 
> > > On Tue, Aug 19, 2014 at 12:28 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > 
> > > > ```
> > > > The Term filter only works on "Not Analysed" fields!
> > > > 
> > > > ```
> > > > 
> > > > Is this right?
> > > > 
> > > > Not exactly.
> > > > 
> > > > Term filter is not analyzed. It means that it's compared as is to what  
> > > > you have in the inverted index.
> > > > 
> > > > So, for example, if you have indexed in the inverted index "A-B-C",  
> > > > searching with a Term Filter for "a-b-c" won't work.  
> > > > "a" won't work as well.
> > > > 
> > > > May be you could create a full SENSE recreation which shows your  
> > > > problem so we can replay it and help you?
> > > > 
> > > > See [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/)
> > > > 
> > > > ```
> > > > --
> > > > 
> > > > ```
> > > > 
> > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > > 
> > > > Le 19 août 2014 à 10:28:15, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > > > 
> > > > David,
> > > > 
> > > > I made a small example to show you the problem and solution:
> > > > 
> > > > 1. Index name: whitespace
> > > > 2. type: mytest
> > > > 
> > > > _Mapping:_
> > > > 
> > > > {  
> > > > mappings: {  
> > > > "mytest": {  
> > > > "\_all": { "analyzer": "whitespace" }  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > _Data_
> > > > 
> > > > {"hostname":["My-Name"]}
> > > > 
> > > > Indexing : oke
> > > > 
> > > > _First Test:_ Is the analyzer = whitespace oke?
> > > > 
> > > > curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q=](http://localhost:9200/whitespace/mytest/_search?q=)  
> > > > "My"&pretty'  
> > > > {  
> > > > "took" : 3,  
> > > > "timed\_out" : false,  
> > > > "\_shards" : {  
> > > > "total" : 5,  
> > > > "successful" : 5,  
> > > > "failed" : 0  
> > > > },  
> > > > "hits" : {  
> > > > "total" : 0,  
> > > > "max\_score" : null,  
> > > > "hits" :   
> > > > }  
> > > > }
> > > > 
> > > > _Result: OKE_
> > > > 
> > > > _Second Test: Ask complete name_
> > > > 
> > > > curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q=](http://localhost:9200/whitespace/mytest/_search?q=)  
> > > > "My-Name"&pretty'  
> > > > {  
> > > > "took" : 4,  
> > > > "timed\_out" : false,  
> > > > "\_shards" : {  
> > > > "total" : 5,  
> > > > "successful" : 5,  
> > > > "failed" : 0  
> > > > },  
> > > > "hits" : {  
> > > > "total" : 1,  
> > > > "max\_score" : 0.30685282,  
> > > > "hits" : [ {  
> > > > "\_index" : "whitespace",  
> > > > "\_type" : "mytest",  
> > > > "\_id" : "2",  
> > > > "\_score" : 0.30685282,  
> > > > "\_source":{"hostname":"My-Name"}  
> > > > } ]  
> > > > }  
> > > > }
> > > > 
> > > > _Result: OKE_
> > > > 
> > > > _Now my problem:_
> > > > 
> > > > _curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search](http://localhost:9200/whitespace/mytest/_search)  
> > > > [http://localhost:9200/whitespace/mytest/\_search](http://localhost:9200/whitespace/mytest/_search)" -d'_  
> > > > _\> {_  
> > > > _\> "query": {_  
> > > > _\> "filtered": {_  
> > > > _\> "filter": {_  
> > > > _\> "term": { "hostname": "My-Name" }_  
> > > > \*\> } \*  
> > > > _\> }_  
> > > > _\> }_  
> > > > _\> }'_
> > > > 
> > > > _{"took":2,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":[]}}_
> > > > 
> > > > _Because the document was indexed with the whitespace analyzer, he  
> > > > should find "My-Name"._
> > > > 
> > > > _Check Analyzer: OKE_  
> > > > curl -XGET  
> > > > 'localhost:9200/\_analyze?analyzer=whitespace&pretty&format=text' -d  
> > > > 'My-Name'  
> > > > {  
> > > > "tokens" : [ {  
> > > > "token" : "My-Name",  
> > > > "start\_offset" : 0,  
> > > > "end\_offset" : 7,  
> > > > "type" : "word",  
> > > > "position" : 1  
> > > > } ]  
> > > > }
> > > > 
> > > > _Test3: not\_analysed_ Index mapping:
> > > > 
> > > > {  
> > > > mappings: {  
> > > > "mytest": {  
> > > > "properties": {  
> > > > "hostname": {  
> > > > "type": "string",  
> > > > "index": "not\_analyzed"  
> > > > }  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > _Then:_
> > > > 
> > > > curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search?pretty](http://localhost:9200/whitespace/mytest/_search?pretty)"  
> > > > -d'  
> > > > {  
> > > > "query": {  
> > > > "filtered": {  
> > > > "filter": {  
> > > > "term": { "hostname": "My-Name" }  
> > > > }  
> > > > }  
> > > > }  
> > > > }'  
> > > > {  
> > > > "took" : 3,  
> > > > "timed\_out" : false,  
> > > > "\_shards" : {  
> > > > "total" : 5,  
> > > > "successful" : 5,  
> > > > "failed" : 0  
> > > > },  
> > > > "hits" : {  
> > > > "total" : 1,  
> > > > "max\_score" : 1.0,  
> > > > "hits" : [ {  
> > > > "\_index" : "whitespace",  
> > > > "\_type" : "mytest",  
> > > > "\_id" : "2",  
> > > > "\_score" : 1.0,  
> > > > "\_source":{"hostname":"My-Name"}  
> > > > } ]  
> > > > }  
> > > > }
> > > > 
> > > > _Result: OKE_
> > > > 
> > > > _Conlusion:_
> > > > 
> > > > The Term filter only works on "Not Analysed" fields!  
> > > > Is this right?
> > > > 
> > > > - Rem:\*  
> > > > No errors in de log files.
> > > > 
> > > > Luc.
> > > > 
> > > > On Mon, Aug 18, 2014 at 3:42 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > > 
> > > > > I think could help you:  
> > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html)
> > > > > 
> > > > > ```
> > > > > --
> > > > > 
> > > > > ```
> > > > > 
> > > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > > > 
> > > > > Le 18 août 2014 à 15:39:36, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > > > > 
> > > > > David hi,
> > > > > 
> > > > > How can I configure the mapping so that the default analyzer will be  
> > > > > the "whitespace" one?
> > > > > 
> > > > > On Wed, Aug 13, 2014 at 2:46 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > > > 
> > > > > > Having no answer is not good. I think something goes wrong here.  
> > > > > > May be you should see something in logs.
> > > > > > 
> > > > > > That said, if you don't want to break your string as tokens at index  
> > > > > > time, you could set index:not\_analyzed for fields you don't want to analyze.
> > > > > > 
> > > > > > But, you should read this part of the book:  
> > > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/analysis-intro.html#analysis-intro)
> > > > > > 
> > > > > > ```
> > > > > > --
> > > > > > 
> > > > > > ```
> > > > > > 
> > > > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > > > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > > > > 
> > > > > > Le 13 août 2014 à 14:39:20, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > > > > > 
> > > > > > I like to use elasticsearch as Nosql database + search engine for  
> > > > > > data coming from text files (router configs) and databases .  
> > > > > > First I moved a routerconfig to a json file which I indexed .
> > > > > > 
> > > > > > Mapping:
> > > > > > 
> > > > > > {  
> > > > > > "configs" : {  
> > > > > > "mappings" : {  
> > > > > > "test" : {  
> > > > > > "properties" : {  
> > > > > > "ConfLength" : {  
> > > > > > "type" : "string"  
> > > > > > },  
> > > > > > "NVRAM" : {  
> > > > > > "type" : "string"  
> > > > > > },  
> > > > > > "aaa" : {  
> > > > > > "type" : "string"  
> > > > > > },  
> > > > > > "enable" : {  
> > > > > > "type" : "string"  
> > > > > > },  
> > > > > > "hostname" : {  
> > > > > > "type" : "string"  
> > > > > > },  
> > > > > > "lastChange" : {  
> > > > > > "type" : "string"  
> > > > > > },  
> > > > > > "logging" : {  
> > > > > > "type" : "string"  
> > > > > > },  
> > > > > > "model" : {  
> > > > > > "type" : "string"  
> > > > > > },  
> > > > > > "policy-map" : {  
> > > > > > "type" : "string"  
> > > > > > }  
> > > > > > }  
> > > > > > }  
> > > > > > }  
> > > > > > }  
> > > > > > }
> > > > > > 
> > > > > > Document:
> > > > > > 
> > > > > > {  
> > > > > > "\_index" : "configs",  
> > > > > > "\_type" : "test",  
> > > > > > "\_id" : "7",  
> > > > > > "\_score" : 1,  
> > > > > > "\_source" : {  
> > > > > > "hostname" : [  
> > > > > > "hostname test-1234"  
> > > > > > ]  
> > > > > > }  
> > > > > > },
> > > > > > 
> > > > > > Example of a simple search: search a hostname.
> > > > > > 
> > > > > > _If I start a query_:
> > > > > > 
> > > > > > _curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)  
> > > > > > [http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"hostname test-1234"'_  
> > > > > > curl: (52) Empty reply from server
> > > > > > 
> > > > > > No respone
> > > > > > 
> > > > > > If I start a second query without hostname if got an answer:
> > > > > > 
> > > > > > _curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)  
> > > > > > [http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"test-1234"'_  
> > > > > > OKE
> > > > > > 
> > > > > > Analyser: standard
> > > > > > 
> > > > > > Why a search instruction can find "test-1234" but not "hostname  
> > > > > > test-1234" ?
> > > > > > 
> > > > > > --  
> > > > > > 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/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com)  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%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 a topic in  
> > > > > > the Google Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this topic, visit  
> > > > > > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe)  
> > > > > > .  
> > > > > > To unsubscribe from this group and all its topics, 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/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local)  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local?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/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.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 a topic in the  
> > > > > Google Groups "elasticsearch" group.  
> > > > > To unsubscribe from this topic, visit  
> > > > > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe)  
> > > > > .  
> > > > > To unsubscribe from this group and all its topics, 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/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local?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/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.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 a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit  
> > > > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, 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/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local?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/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf\_adAKJ5YcXQTTSZD\_51w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf_adAKJ5YcXQTTSZD_51w%40mail.gmail.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf\_adAKJ5YcXQTTSZD\_51w%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf_adAKJ5YcXQTTSZD_51w%40mail.gmail.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 a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
> > > To unsubscribe from this group and all its topics, 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/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local)  
> > > [https://groups.google.com/d/msgid/elasticsearch/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local?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/CAA0yNqJp1B0fGvQgJJKkx\_1%3DMmDWH\_ALt36B6JSRaNejhRMUag%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJp1B0fGvQgJJKkx_1%3DMmDWH_ALt36B6JSRaNejhRMUag%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJp1B0fGvQgJJKkx\_1%3DMmDWH\_ALt36B6JSRaNejhRMUag%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJp1B0fGvQgJJKkx_1%3DMmDWH_ALt36B6JSRaNejhRMUag%40mail.gmail.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 a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
> > To unsubscribe from this group and all its topics, 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/etPan.53f3a10e.1d4ed43b.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f3a10e.1d4ed43b.132%40MacBook-Air-de-David.local)  
> > [https://groups.google.com/d/msgid/elasticsearch/etPan.53f3a10e.1d4ed43b.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f3a10e.1d4ed43b.132%40MacBook-Air-de-David.local?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/CAA0yNqLfibWpAtppYq6nd5-0BkZsEyMTeuQUWgOrCn5mn2TUpw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLfibWpAtppYq6nd5-0BkZsEyMTeuQUWgOrCn5mn2TUpw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Luc\_Evers](https://avatars.discourse-cdn.com/v4/letter/l/aeb1de/32.png) [@Luc\_Evers](https://discuss.elastic.co/u/Luc_Evers)
#### Post date: [August 20, 2014, 6:09pm UTC](https://discuss.elastic.co/t/query-problem/19253/13 "2014-08-20T18:09:03Z")

</div>

The last request was a global default "whitespace" configuration:

Working configuration: settings during indexing:

{

```
 "settings": {

       "index": {

           "analysis": {

             "analyzer": {

                 "default": {

                    "type":"whitespace"

             }

       }

}

```

}

}

}

Rem  
During indexing and mapping only json parsing is checked, wrong  
configuration was not seen even not in the log files. Maybe a plugin can  
help.

On Wed, Aug 20, 2014 at 2:12 PM, Luc Evers [lucevers@gmail.com](mailto:lucevers@gmail.com) wrote:

> For Info
> 
> Problem caused due to a wrong mapping configuration.
> 
> This one solved my problem:
> 
> {  
> mappings: {  
> "mytest" : {  
> "index\_analyzer" : "whitespace"  
> }  
> }  
> }
> 
> On Wed, Aug 20, 2014 at 8:03 AM, Luc Evers [lucevers@gmail.com](mailto:lucevers@gmail.com) wrote:
> 
> > The \_all field is a special field:
> > 
> > The \_all field allows us to create a field where the contents of other  
> > fields will  
> > be copied as well...
> > 
> > I shall test further and shall find out the problem, thanks for help !
> > 
> > On Tue, Aug 19, 2014 at 9:10 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > 
> > > You are searching in hostname field not in \_all. I think that's your  
> > > problem here.
> > > 
> > > --  
> > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > 
> > > Le 19 août 2014 à 19:53:53, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > > 
> > > David,
> > > 
> > > - I have a very simple example:\*
> > > 
> > > 1. Below the data file "configs.json"
> > > 
> > > {"hostname":["My-Name"]}
> > > 
> > > 1. the mapping file: "_\_configs.json"_
> > > 
> > > > ```
> > > > mappings: {
> > > > "mytest": {
> > > > "_all": { "analyzer": "whitespace" }
> > > > }
> > > > 
> > > > ```
> > > > 
> > > > }  
> > > > }
> > > 
> > > Thats All
> > > 
> > > Index the 'configs.json' with the mapping '\_configs.json'
> > > 
> > > 1. Send a search request:
> > > 
> > > _Sense example_
> > > 
> > > POST /whitespace/mytest/\_search  
> > > {  
> > > "query": {  
> > > "filtered": {  
> > > "filter": {  
> > > "term": { "hostname": "My-Name" }  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > This example shall fail if the analyser is "whitespace".  
> > > If you don't analyse ("not\_analyzed") the example shall work.  
> > > Because the whitespace analyser don't split the string "My-Name", the  
> > > test should work!
> > > 
> > > Rem  
> > > The index name "whitespace" is only done for remembering which test  
> > > is which index.
> > > 
> > > Luc.
> > > 
> > > On Tue, Aug 19, 2014 at 3:22 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > 
> > > > I have no idea without understanding exactly what you are doing.  
> > > > So a SENSE recreation would help a lot.
> > > > 
> > > > ```
> > > > --
> > > > 
> > > > ```
> > > > 
> > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > > 
> > > > Le 19 août 2014 à 13:53:16, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > > > 
> > > > David,
> > > > 
> > > > In my case: "My-Name" why a term filter didn't work on a whitespace  
> > > > filter?
> > > > 
> > > > Luc.
> > > > 
> > > > On Tue, Aug 19, 2014 at 12:28 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > > 
> > > > > ```
> > > > > The Term filter only works on "Not Analysed" fields!
> > > > > 
> > > > > ```
> > > > > 
> > > > > Is this right?
> > > > > 
> > > > > Not exactly.
> > > > > 
> > > > > Term filter is not analyzed. It means that it's compared as is to what  
> > > > > you have in the inverted index.
> > > > > 
> > > > > So, for example, if you have indexed in the inverted index "A-B-C",  
> > > > > searching with a Term Filter for "a-b-c" won't work.  
> > > > > "a" won't work as well.
> > > > > 
> > > > > May be you could create a full SENSE recreation which shows your  
> > > > > problem so we can replay it and help you?
> > > > > 
> > > > > See [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/)
> > > > > 
> > > > > ```
> > > > > --
> > > > > 
> > > > > ```
> > > > > 
> > > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > > > 
> > > > > Le 19 août 2014 à 10:28:15, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > > > > 
> > > > > David,
> > > > > 
> > > > > I made a small example to show you the problem and solution:
> > > > > 
> > > > > 1. Index name: whitespace
> > > > > 2. type: mytest
> > > > > 
> > > > > _Mapping:_
> > > > > 
> > > > > {  
> > > > > mappings: {  
> > > > > "mytest": {  
> > > > > "\_all": { "analyzer": "whitespace" }  
> > > > > }  
> > > > > }  
> > > > > }
> > > > > 
> > > > > _Data_
> > > > > 
> > > > > {"hostname":["My-Name"]}
> > > > > 
> > > > > Indexing : oke
> > > > > 
> > > > > _First Test:_ Is the analyzer = whitespace oke?
> > > > > 
> > > > > curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q=](http://localhost:9200/whitespace/mytest/_search?q=)  
> > > > > "My"&pretty'  
> > > > > {  
> > > > > "took" : 3,  
> > > > > "timed\_out" : false,  
> > > > > "\_shards" : {  
> > > > > "total" : 5,  
> > > > > "successful" : 5,  
> > > > > "failed" : 0  
> > > > > },  
> > > > > "hits" : {  
> > > > > "total" : 0,  
> > > > > "max\_score" : null,  
> > > > > "hits" :   
> > > > > }  
> > > > > }
> > > > > 
> > > > > _Result: OKE_
> > > > > 
> > > > > _Second Test: Ask complete name_
> > > > > 
> > > > > curl -XGET '[http://localhost:9200/whitespace/mytest/\_search?q=](http://localhost:9200/whitespace/mytest/_search?q=)  
> > > > > "My-Name"&pretty'  
> > > > > {  
> > > > > "took" : 4,  
> > > > > "timed\_out" : false,  
> > > > > "\_shards" : {  
> > > > > "total" : 5,  
> > > > > "successful" : 5,  
> > > > > "failed" : 0  
> > > > > },  
> > > > > "hits" : {  
> > > > > "total" : 1,  
> > > > > "max\_score" : 0.30685282,  
> > > > > "hits" : [ {  
> > > > > "\_index" : "whitespace",  
> > > > > "\_type" : "mytest",  
> > > > > "\_id" : "2",  
> > > > > "\_score" : 0.30685282,  
> > > > > "\_source":{"hostname":"My-Name"}  
> > > > > } ]  
> > > > > }  
> > > > > }
> > > > > 
> > > > > _Result: OKE_
> > > > > 
> > > > > _Now my problem:_
> > > > > 
> > > > > _curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search](http://localhost:9200/whitespace/mytest/_search)  
> > > > > [http://localhost:9200/whitespace/mytest/\_search](http://localhost:9200/whitespace/mytest/_search)" -d'_  
> > > > > _\> {_  
> > > > > _\> "query": {_  
> > > > > _\> "filtered": {_  
> > > > > _\> "filter": {_  
> > > > > _\> "term": { "hostname": "My-Name" }_  
> > > > > \*\> } \*  
> > > > > _\> }_  
> > > > > _\> }_  
> > > > > _\> }'_
> > > > > 
> > > > > _{"took":2,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":[]}}_
> > > > > 
> > > > > _Because the document was indexed with the whitespace analyzer, he  
> > > > > should find "My-Name"._
> > > > > 
> > > > > _Check Analyzer: OKE_  
> > > > > curl -XGET  
> > > > > 'localhost:9200/\_analyze?analyzer=whitespace&pretty&format=text' -d  
> > > > > 'My-Name'  
> > > > > {  
> > > > > "tokens" : [ {  
> > > > > "token" : "My-Name",  
> > > > > "start\_offset" : 0,  
> > > > > "end\_offset" : 7,  
> > > > > "type" : "word",  
> > > > > "position" : 1  
> > > > > } ]  
> > > > > }
> > > > > 
> > > > > _Test3: not\_analysed_ Index mapping:
> > > > > 
> > > > > {  
> > > > > mappings: {  
> > > > > "mytest": {  
> > > > > "properties": {  
> > > > > "hostname": {  
> > > > > "type": "string",  
> > > > > "index": "not\_analyzed"  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }
> > > > > 
> > > > > _Then:_
> > > > > 
> > > > > curl -XPOST "[http://localhost:9200/whitespace/mytest/\_search?pretty](http://localhost:9200/whitespace/mytest/_search?pretty)"  
> > > > > -d'  
> > > > > {  
> > > > > "query": {  
> > > > > "filtered": {  
> > > > > "filter": {  
> > > > > "term": { "hostname": "My-Name" }  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }'  
> > > > > {  
> > > > > "took" : 3,  
> > > > > "timed\_out" : false,  
> > > > > "\_shards" : {  
> > > > > "total" : 5,  
> > > > > "successful" : 5,  
> > > > > "failed" : 0  
> > > > > },  
> > > > > "hits" : {  
> > > > > "total" : 1,  
> > > > > "max\_score" : 1.0,  
> > > > > "hits" : [ {  
> > > > > "\_index" : "whitespace",  
> > > > > "\_type" : "mytest",  
> > > > > "\_id" : "2",  
> > > > > "\_score" : 1.0,  
> > > > > "\_source":{"hostname":"My-Name"}  
> > > > > } ]  
> > > > > }  
> > > > > }
> > > > > 
> > > > > _Result: OKE_
> > > > > 
> > > > > _Conlusion:_
> > > > > 
> > > > > The Term filter only works on "Not Analysed" fields!  
> > > > > Is this right?
> > > > > 
> > > > > - Rem:\*  
> > > > > No errors in de log files.
> > > > > 
> > > > > Luc.
> > > > > 
> > > > > On Mon, Aug 18, 2014 at 3:42 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > > > 
> > > > > > I think could help you:  
> > > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html)
> > > > > > 
> > > > > > ```
> > > > > > --
> > > > > > 
> > > > > > ```
> > > > > > 
> > > > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > > > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > > > > 
> > > > > > Le 18 août 2014 à 15:39:36, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > > > > > 
> > > > > > David hi,
> > > > > > 
> > > > > > How can I configure the mapping so that the default analyzer will  
> > > > > > be the "whitespace" one?
> > > > > > 
> > > > > > On Wed, Aug 13, 2014 at 2:46 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr)  
> > > > > > wrote:
> > > > > > 
> > > > > > > Having no answer is not good. I think something goes wrong here.  
> > > > > > > May be you should see something in logs.
> > > > > > > 
> > > > > > > That said, if you don't want to break your string as tokens at  
> > > > > > > index time, you could set index:not\_analyzed for fields you don't want to  
> > > > > > > analyze.
> > > > > > > 
> > > > > > > But, you should read this part of the book:  
> > > > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/analysis-intro.html#analysis-intro)
> > > > > > > 
> > > > > > > ```
> > > > > > > --
> > > > > > > 
> > > > > > > ```
> > > > > > > 
> > > > > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr  
> > > > > > > [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > > > > > > 
> > > > > > > Le 13 août 2014 à 14:39:20, Luc Evers ([lucevers@gmail.com](mailto:lucevers@gmail.com)) a écrit:
> > > > > > > 
> > > > > > > I like to use elasticsearch as Nosql database + search engine for  
> > > > > > > data coming from text files (router configs) and databases .  
> > > > > > > First I moved a routerconfig to a json file which I indexed .
> > > > > > > 
> > > > > > > Mapping:
> > > > > > > 
> > > > > > > {  
> > > > > > > "configs" : {  
> > > > > > > "mappings" : {  
> > > > > > > "test" : {  
> > > > > > > "properties" : {  
> > > > > > > "ConfLength" : {  
> > > > > > > "type" : "string"  
> > > > > > > },  
> > > > > > > "NVRAM" : {  
> > > > > > > "type" : "string"  
> > > > > > > },  
> > > > > > > "aaa" : {  
> > > > > > > "type" : "string"  
> > > > > > > },  
> > > > > > > "enable" : {  
> > > > > > > "type" : "string"  
> > > > > > > },  
> > > > > > > "hostname" : {  
> > > > > > > "type" : "string"  
> > > > > > > },  
> > > > > > > "lastChange" : {  
> > > > > > > "type" : "string"  
> > > > > > > },  
> > > > > > > "logging" : {  
> > > > > > > "type" : "string"  
> > > > > > > },  
> > > > > > > "model" : {  
> > > > > > > "type" : "string"  
> > > > > > > },  
> > > > > > > "policy-map" : {  
> > > > > > > "type" : "string"  
> > > > > > > }  
> > > > > > > }  
> > > > > > > }  
> > > > > > > }  
> > > > > > > }  
> > > > > > > }
> > > > > > > 
> > > > > > > Document:
> > > > > > > 
> > > > > > > {  
> > > > > > > "\_index" : "configs",  
> > > > > > > "\_type" : "test",  
> > > > > > > "\_id" : "7",  
> > > > > > > "\_score" : 1,  
> > > > > > > "\_source" : {  
> > > > > > > "hostname" : [  
> > > > > > > "hostname test-1234"  
> > > > > > > ]  
> > > > > > > }  
> > > > > > > },
> > > > > > > 
> > > > > > > Example of a simple search: search a hostname.
> > > > > > > 
> > > > > > > _If I start a query_:
> > > > > > > 
> > > > > > > _curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)  
> > > > > > > [http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"hostname test-1234"'_  
> > > > > > > curl: (52) Empty reply from server
> > > > > > > 
> > > > > > > No respone
> > > > > > > 
> > > > > > > If I start a second query without hostname if got an answer:
> > > > > > > 
> > > > > > > _curl -XGET '[http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)  
> > > > > > > [http://127.0.0.1:9200/configs/\_search?q=](http://127.0.0.1:9200/configs/_search?q=)"test-1234"'_  
> > > > > > > OKE
> > > > > > > 
> > > > > > > Analyser: standard
> > > > > > > 
> > > > > > > Why a search instruction can find "test-1234" but not "hostname  
> > > > > > > test-1234" ?
> > > > > > > 
> > > > > > > --  
> > > > > > > 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/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com)  
> > > > > > > [https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/b25127bb-2dca-440c-a7b3-937b5ddccd6d%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 a topic in  
> > > > > > > the Google Groups "elasticsearch" group.  
> > > > > > > To unsubscribe from this topic, visit  
> > > > > > > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe)  
> > > > > > > .  
> > > > > > > To unsubscribe from this group and all its topics, 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/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local)  
> > > > > > > [https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53eb5e1b.3804823e.18f0%40MacBook-Air-de-David.local?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/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com)  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLNnQK0%2BtJgRkOqwgJawqngMjmWJfXDgijpcuEbQYbyZw%40mail.gmail.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 a topic in  
> > > > > > the Google Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this topic, visit  
> > > > > > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe)  
> > > > > > .  
> > > > > > To unsubscribe from this group and all its topics, 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/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local)  
> > > > > > [https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f202c7.2eb141f2.132%40MacBook-Air-de-David.local?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/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJfm0w6vqmFHEgVVDHjJqtnT1yH8%2BWh2WGv3AYXcpBfCg%40mail.gmail.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 a topic in the  
> > > > > Google Groups "elasticsearch" group.  
> > > > > To unsubscribe from this topic, visit  
> > > > > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe)  
> > > > > .  
> > > > > To unsubscribe from this group and all its topics, 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/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f326d2.4e6afb66.132%40MacBook-Air-de-David.local?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/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf\_adAKJ5YcXQTTSZD\_51w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf_adAKJ5YcXQTTSZD_51w%40mail.gmail.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf\_adAKJ5YcXQTTSZD\_51w%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqLF%2B%3DWGuutmZ%2BS1C09uPhC%3D%2Bf_adAKJ5YcXQTTSZD_51w%40mail.gmail.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 a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit  
> > > > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, 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/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f34fab.257130a3.132%40MacBook-Air-de-David.local?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/CAA0yNqJp1B0fGvQgJJKkx\_1%3DMmDWH\_ALt36B6JSRaNejhRMUag%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJp1B0fGvQgJJKkx_1%3DMmDWH_ALt36B6JSRaNejhRMUag%40mail.gmail.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJp1B0fGvQgJJKkx\_1%3DMmDWH\_ALt36B6JSRaNejhRMUag%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAA0yNqJp1B0fGvQgJJKkx_1%3DMmDWH_ALt36B6JSRaNejhRMUag%40mail.gmail.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 a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/xOrC6RMG\_nw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/xOrC6RMG_nw/unsubscribe).  
> > > To unsubscribe from this group and all its topics, 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/etPan.53f3a10e.1d4ed43b.132%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53f3a10e.1d4ed43b.132%40MacBook-Air-de-David.local)  
> > > [https://groups.google.com/d/msgid/elasticsearch/etPan.53f3a10e.1d4ed43b.132%40MacBook-Air-de-David.local?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/etPan.53f3a10e.1d4ed43b.132%40MacBook-Air-de-David.local?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/CAA0yNq%2BUcfB9kGuSDhiq5YQiGkvtR\_sbbg4Kkz%2BFusMDh\_\_39g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAA0yNq%2BUcfB9kGuSDhiq5YQiGkvtR_sbbg4Kkz%2BFusMDh__39g%40mail.gmail.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:07am UTC](https://discuss.elastic.co/t/query-problem/19253/14 "2017-07-06T01:07:22Z")

</div>


