# I can't find anything after hypens or underscores

**URL:** <https://discuss.elastic.co/t/i-cant-find-anything-after-hypens-or-underscores/20705>\
**Category:** Elasticsearch\
**Created:** [November 12, 2014, 1:15pm UTC](https://discuss.elastic.co/t/i-cant-find-anything-after-hypens-or-underscores/20705 "2014-11-12T13:15:17Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![bnf\_lsn](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@bnf\_lsn](https://discuss.elastic.co/u/bnf_lsn)\
**Post date:** [November 12, 2014, 1:15pm UTC](https://discuss.elastic.co/t/i-cant-find-anything-after-hypens-or-underscores/20705/1 "2014-11-12T13:15:17Z")

</div>

Hi, I'm very newbie on ElasticSearch.  
I'm try to indexing a set of biological data. There are some fields like  
'gene\_id' or 'gene\_shortname' that should be processed as literal strings.  
When I try to search for 'ZNF6092' in a field filled with 'linc-ZNF6092-6',  
I can't find anything. When I search for 'linc' I find correct document  
elsewhere.  
It seems that this is a problem with ES analyzer, but I tried to set it for  
do not analyze fields, but it seems that nothing changes.  
I try with:

curl -XPOST 'localhost:9200/a3' -d @tracking\_map.json

where tracking\_map.json is

{  
"mappings": {  
"tracking": {  
"properties": {  
"tracking\_id" : {  
"type": "string",  
"index":"not\_analyzed"  
},  
"nearest\_ref\_id" : {  
"type": "string",  
"index":"not\_analyzed"  
},  
"gene\_id" : {  
"type": "string",  
"index":"not\_analyzed"  
},  
"gene\_short\_name" : {  
"type": "string",  
"index":"not\_analyzed"  
}  
}  
}  
}  
}

And then re-indexing of all documents. I failed, but where?  
Thanks in advance,

Alessandro

--  
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/ce070db4-dee9-42e2-9f5a-ee8aa645e2f5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ce070db4-dee9-42e2-9f5a-ee8aa645e2f5%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [November 12, 2014, 2:25pm UTC](https://discuss.elastic.co/t/i-cant-find-anything-after-hypens-or-underscores/20705/2 "2014-11-12T14:25:15Z")

</div>

On Wed, Nov 12, 2014 at 8:15 AM, Alessandro Bonfanti [bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)  
wrote:

> Hi, I'm very newbie on Elasticsearch.  
> I'm try to indexing a set of biological data. There are some fields like  
> 'gene\_id' or 'gene\_shortname' that should be processed as literal strings.  
> When I try to search for 'ZNF6092' in a field filled with  
> 'linc-ZNF6092-6', I can't find anything. When I search for 'linc' I find  
> correct document elsewhere.  
> It seems that this is a problem with ES analyzer, but I tried to set it  
> for do not analyze fields, but it seems that nothing changes.  
> I try with:
> 
> curl -XPOST 'localhost:9200/a3' -d @tracking\_map.json
> 
> where tracking\_map.json is
> 
> {  
> "mappings": {  
> "tracking": {  
> "properties": {  
> "tracking\_id" : {  
> "type": "string",  
> "index":"not\_analyzed"  
> },  
> "nearest\_ref\_id" : {  
> "type": "string",  
> "index":"not\_analyzed"  
> },  
> "gene\_id" : {  
> "type": "string",  
> "index":"not\_analyzed"  
> },  
> "gene\_short\_name" : {  
> "type": "string",  
> "index":"not\_analyzed"  
> }  
> }  
> }  
> }  
> }
> 
> And then re-indexing of all documents. I failed, but where?  
> Thanks in advance,
> 
> Alessandro

Its an analyzer problem, certainly. You've turned off analyzers with  
"index":"not\_analazyed". What you probably want is for the gene\_short\_name  
to be analyzed so that dashes are considered "word separators". If you do  
that you can find linc-ZNF6092-6 by performing a simple\_query\_string (or  
match) search for `ZNF6092` or `ZNF6092 6` or  
`6` or `linc`. Have a look at

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

and go from there. You may also want to use a lowercase filter so you can  
search for `znf6092` and still find it.

This is a good read on how to change the mapping as well:

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

even if you don't need all the information in there it is nice to know.

Nik

--  
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/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy\_ZdOJQhKYzQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![bnf\_lsn](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@bnf\_lsn](https://discuss.elastic.co/u/bnf_lsn)\
**Post date:** [November 12, 2014, 4:13pm UTC](https://discuss.elastic.co/t/i-cant-find-anything-after-hypens-or-underscores/20705/3 "2014-11-12T16:13:49Z")

</div>

Il 12/11/2014 15:25, Nikolas Everett ha  
scritto:

> On Wed, Nov 12, 2014 at 8:15 AM,  
> Alessandro Bonfanti \<[bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)\> wrote:
> 
> > Hi, I'm very newbie on ElasticSearch. 
> > 
> > ```
> > I'm try to indexing a set of biological data. There are
> > some fields like 'gene_id' or 'gene_shortname' that
> > should be processed as literal strings.
> > 
> > When I try to search for 'ZNF6092' in a field filled
> > with 'linc-ZNF6092-6', I can't find anything. When I
> > search for 'linc' I find correct document elsewhere.
> > 
> > It seems that this is a problem with ES analyzer, but I
> > tried to set it for do not analyze fields, but it seems
> > that nothing changes.
> > 
> > I try with:
> > 
> > ```
> > 
> > `curl -XPOST 'localhost:9200/a3'-d @tracking_map.json`
> > 
> > `
> > `
> > 
> > ```
> > where tracking_map.json is
> > 
> > ```
> > 
> > `{`
> > 
> > `
> > ```
> > "mappings":{
> > 
> > "tracking":{
> > 
> > "properties":{
> > 
> > "tracking_id":{
> > 
> > "type":"string",
> > 
> > "index":"not_analyzed"
> > 
> > },
> > 
> > "nearest_ref_id":{
> > 
> > "type":"string",
> > 
> > "index":"not_analyzed"
> > 
> > },
> > 
> > "gene_id":{
> > 
> > "type":"string",
> > 
> > "index":"not_analyzed"
> > 
> > },
> > 
> > "gene_short_name":{
> > 
> > "type":"string",
> > 
> > "index":"not_analyzed"
> > 
> > }
> > 
> > }
> > 
> > }
> > 
> > }
> > 
> > ```
> > }
> > `
> > 
> > ```
> > And then re-indexing of all documents. I failed, but
> > where?
> > 
> > Thanks in advance,
> > 
> > Alessandro
> > 
> > ```
> 
> Its an analyzer problem, certainly. You've turned off  
> analyzers with "index":"not\_analazyed". What you probably  
> want is for the gene\_short\_name to be analyzed so that  
> dashes are considered "word separators". If you do that  
> you can find linc-ZNF6092-6 by performing a  
> simple\_query\_string (or match) search for  
> \<code\>ZNF6092\</code\> or \<code\>ZNF6092  
> 6\</code\> or \<code\>6\</code\> or  
> \<code\>linc\</code\>. Have a look at [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html)  
> and go from there. You may also want to use a lowercase  
> filter so you can search for  
> \<code\>znf6092\</code\> and still find it.
> 
> This is a good read on how to change the mapping as  
> well:
> 
> [http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/](http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/)
> 
> even if you don't need all the information in there it  
> is nice to know.
> 
> ```
> Nik
> 
> -- 
> 
> You received this message because you are subscribed to a topic in
> the Google Groups "elasticsearch" group.
> 
> To unsubscribe from this topic, visit <a moz-do-not-send="true" href="https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe">https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe</a>.
> 
> To unsubscribe from this group and all its topics, send an email
> to <a moz-do-not-send="true" href="mailto:elasticsearch+unsubscribe@googlegroups.com">elasticsearch+unsubscribe@googlegroups.com</a>.
> 
> To view this discussion on the web visit <a moz-do-not-send="true" href="https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com?utm_medium=email&amp;utm_source=footer">https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com</a>.
> 
> For more options, visit <a moz-do-not-send="true" href="https://groups.google.com/d/optout">https://groups.google.com/d/optout</a>.
> 
> ```

 Very thanks for your answer,

```
What I want is that ES store fields as literals, so I should find
ZNF6092 with a wilcard search (*ZNF6092* for example).

I tried set "pattern" to "*" for testing (* isn't in gene_shortname,
so I suppose that entire string is stored. But anyway I still find
nothing.

```

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [November 12, 2014, 4:20pm UTC](https://discuss.elastic.co/t/i-cant-find-anything-after-hypens-or-underscores/20705/4 "2014-11-12T16:20:45Z")

</div>

On Wed, Nov 12, 2014 at 11:13 AM, Alessandro Bonfanti [bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)  
wrote:

> Il 12/11/2014 15:25, Nikolas Everett ha scritto:
> 
> On Wed, Nov 12, 2014 at 8:15 AM, Alessandro Bonfanti [bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)  
> wrote:
> 
> > Hi, I'm very newbie on Elasticsearch.  
> > I'm try to indexing a set of biological data. There are some fields like  
> > 'gene\_id' or 'gene\_shortname' that should be processed as literal strings.  
> > When I try to search for 'ZNF6092' in a field filled with  
> > 'linc-ZNF6092-6', I can't find anything. When I search for 'linc' I find  
> > correct document elsewhere.  
> > It seems that this is a problem with ES analyzer, but I tried to set it  
> > for do not analyze fields, but it seems that nothing changes.  
> > I try with:
> > 
> > curl -XPOST 'localhost:9200/a3' -d @tracking\_map.json
> > 
> > where tracking\_map.json is
> > 
> > {  
> > "mappings": {  
> > "tracking": {  
> > "properties": {  
> > "tracking\_id" : {  
> > "type": "string",  
> > "index":"not\_analyzed"  
> > },  
> > "nearest\_ref\_id" : {  
> > "type": "string",  
> > "index":"not\_analyzed"  
> > },  
> > "gene\_id" : {  
> > "type": "string",  
> > "index":"not\_analyzed"  
> > },  
> > "gene\_short\_name" : {  
> > "type": "string",  
> > "index":"not\_analyzed"  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > And then re-indexing of all documents. I failed, but where?  
> > Thanks in advance,
> > 
> > Alessandro
> 
> Its an analyzer problem, certainly. You've turned off analyzers with  
> "index":"not\_analazyed". What you probably want is for the gene\_short\_name  
> to be analyzed so that dashes are considered "word separators". If you do  
> that you can find linc-ZNF6092-6 by performing a simple\_query\_string (or  
> match) search for `ZNF6092` or `ZNF6092 6` or  
> `6` or `linc`. Have a look at  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html)  
> and go from there. You may also want to use a lowercase filter so you can  
> search for `znf6092` and still find it.
> 
> This is a good read on how to change the mapping as well:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/)  
> even if you don't need all the information in there it is nice to know.
> 
> ## Nik
> 
> 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/Y6I2qNZxR-s/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/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/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy\_ZdOJQhKYzQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy\_ZdOJQhKYzQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%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).
> 
> Very thanks for your answer,  
> What I want is that ES store fields as literals, so I should find ZNF6092  
> with a wilcard search (_ZNF6092_ for example).  
> I tried set "pattern" to "_" for testing (_ isn't in gene\_shortname, so I  
> suppose that entire string is stored. But anyway I still find nothing.

You'd have to post your queries for me to help more but in general if best  
to analyze the content up front and perform basic match queries without  
wildcards than it is to search with wildcards. Wildcards are way way way  
slower.

Nik

--  
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/CAPmjWd0itbdHQ-maOuOmrrYf2QCqMFORTG21QpFHOCrp9E0rmg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0itbdHQ-maOuOmrrYf2QCqMFORTG21QpFHOCrp9E0rmg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![bnf\_lsn](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@bnf\_lsn](https://discuss.elastic.co/u/bnf_lsn)\
**Post date:** [November 12, 2014, 4:43pm UTC](https://discuss.elastic.co/t/i-cant-find-anything-after-hypens-or-underscores/20705/5 "2014-11-12T16:43:07Z")

</div>

Il 12/11/2014 17:20, Nikolas Everett ha  
scritto:

> On Wed, Nov 12, 2014 at 11:13 AM,  
> Alessandro Bonfanti \<[bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)\> wrote:
> 
> > Il 12/11/2014 15:25, Nikolas Everett ha scritto:
> > 
> > > On Wed, Nov 12, 2014  
> > > at 8:15 AM, Alessandro Bonfanti \<[bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)\>  
> > > wrote:
> > > 
> > > > Hi, I'm very newbie on ElasticSearch. 
> > > > 
> > > > ```
> > > > I'm try to indexing a set of biological
> > > > data. There are some fields like
> > > > 'gene_id' or 'gene_shortname' that
> > > > should be processed as literal strings.
> > > > 
> > > > When I try to search for 'ZNF6092' in a
> > > > field filled with 'linc-ZNF6092-6', I
> > > > can't find anything. When I search for
> > > > 'linc' I find correct document
> > > > elsewhere.
> > > > 
> > > > It seems that this is a problem with ES
> > > > analyzer, but I tried to set it for do
> > > > not analyze fields, but it seems that
> > > > nothing changes.
> > > > 
> > > > I try with:
> > > > 
> > > > ```
> > > > 
> > > > `curl
> > > > -XPOST 'localhost:9200/a3'-d @tracking_map.json`
> > > > 
> > > > `
> > > > `
> > > > 
> > > > ```
> > > > where tracking_map.json is
> > > > 
> > > > ```
> > > > 
> > > > `{`
> > > > 
> > > > `
> > > > ```
> > > > "mappings":{
> > > > 
> > > > "tracking":{
> > > > 
> > > > "properties":{
> > > > 
> > > > "tracking_id":{
> > > > 
> > > > "type":"string",
> > > > 
> > > > "index":"not_analyzed"
> > > > 
> > > > },
> > > > 
> > > > "nearest_ref_id":{
> > > > 
> > > > "type":"string",
> > > > 
> > > > "index":"not_analyzed"
> > > > 
> > > > },
> > > > 
> > > > "gene_id":{
> > > > 
> > > > "type":"string",
> > > > 
> > > > "index":"not_analyzed"
> > > > 
> > > > },
> > > > 
> > > > "gene_short_name":{
> > > > 
> > > > "type":"string",
> > > > 
> > > > "index":"not_analyzed"
> > > > 
> > > > }
> > > > 
> > > > }
> > > > 
> > > > }
> > > > 
> > > > }
> > > > 
> > > > ```
> > > > }
> > > > `
> > > > 
> > > > ```
> > > > And then re-indexing of all documents. I
> > > > failed, but where?
> > > > 
> > > > Thanks in advance,
> > > > 
> > > > Alessandro
> > > > 
> > > > ```
> > > 
> > > Its an analyzer problem, certainly.  
> > > You've turned off analyzers with  
> > > "index":"not\_analazyed". What you  
> > > probably want is for the gene\_short\_name  
> > > to be analyzed so that dashes are  
> > > considered "word separators". If you do  
> > > that you can find linc-ZNF6092-6 by  
> > > performing a simple\_query\_string (or  
> > > match) search for  
> > > \<code\>ZNF6092\</code\> or  
> > > \<code\>ZNF6092 6\</code\> or  
> > > \<code\>6\</code\> or  
> > > \<code\>linc\</code\>. Have a  
> > > look at [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html)  
> > > and go from there. You may also want to  
> > > use a lowercase filter so you can search  
> > > for \<code\>znf6092\</code\> and  
> > > still find it.
> > > 
> > > This is a good read on how to change  
> > > the mapping as well:
> > > 
> > > [http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/](http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/)
> > > 
> > > even if you don't need all the  
> > > information in there it is nice to know.
> > > 
> > > ```
> > > Nik
> > > 
> > > -- 
> > > 
> > > You received this message because you are subscribed
> > > to a topic in the Google Groups "elasticsearch" group.
> > > 
> > > To unsubscribe from this topic, visit <a moz-do-not-send="true" href="https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe" target="_blank">https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe</a>.
> > > 
> > > To unsubscribe from this group and all its topics,
> > > send an email to <a moz-do-not-send="true" href="mailto:elasticsearch+unsubscribe@googlegroups.com" target="_blank">elasticsearch+unsubscribe@googlegroups.com</a>.
> > > 
> > > To view this discussion on the web visit <a moz-do-not-send="true" href="https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" target="_blank">https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com</a>.
> > > 
> > > For more options, visit <a moz-do-not-send="true" href="https://groups.google.com/d/optout" target="_blank">https://groups.google.com/d/optout</a>.
> > > 
> > > ```
> > 
> > Very thanks for your answer,
> > 
> > ```
> > What I want is that ES store fields as literals, so I
> > should find ZNF6092 with a wilcard search (*ZNF6092* for
> > example).
> > 
> > I tried set "pattern" to "*" for testing (* isn't in
> > gene_shortname, so I suppose that entire string is
> > stored. But anyway I still find nothing.
> > 
> > ```
> 
> You'd have to post your queries for me to help more but  
> in general if best to analyze the content up front and  
> perform basic match queries without wildcards than it is  
> to search with wildcards. Wildcards are way way way  
> slower.
> 
> ```
> Nik 
> 
> -- 
> 
> You received this message because you are subscribed to a topic in
> the Google Groups "elasticsearch" group.
> 
> To unsubscribe from this topic, visit <a moz-do-not-send="true" href="https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe">https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe</a>.
> 
> To unsubscribe from this group and all its topics, send an email
> to <a moz-do-not-send="true" href="mailto:elasticsearch+unsubscribe@googlegroups.com">elasticsearch+unsubscribe@googlegroups.com</a>.
> 
> To view this discussion on the web visit <a moz-do-not-send="true" href="https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0itbdHQ-maOuOmrrYf2QCqMFORTG21QpFHOCrp9E0rmg%40mail.gmail.com?utm_medium=email&amp;utm_source=footer">https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0itbdHQ-maOuOmrrYf2QCqMFORTG21QpFHOCrp9E0rmg%40mail.gmail.com</a>.
> 
> For more options, visit <a moz-do-not-send="true" href="https://groups.google.com/d/optout">https://groups.google.com/d/optout</a>.
> 
> ```

```
This is my query (in Ruby):

```

```
@client.search index: @index, body: {query: {wildcard: {_all: query_text}}}
```

```
Variables' name should be auto-explicative of its content.

I read that wildcards are slower, if you have a more clean solution
(I need anyway that I still can search for "linc-ZNF6092" in
addiction for "ZNF6092") it will be very welcome.

```

---

<div class="post-metadata">

**Author:** ![bnf\_lsn](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@bnf\_lsn](https://discuss.elastic.co/u/bnf_lsn)\
**Post date:** [December 2, 2014, 8:21am UTC](https://discuss.elastic.co/t/i-cant-find-anything-after-hypens-or-underscores/20705/6 "2014-12-02T08:21:04Z")

</div>

Il 12/11/2014 17:43, Alessandro  
Bonfanti ha scritto:

> Il 12/11/2014 17:20, Nikolas Everett ha scritto:
> 
> > On Wed, Nov 12, 2014 at 11:13 AM,  
> > Alessandro Bonfanti \<[bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)\>  
> > wrote:
> > 
> > > Il 12/11/2014 15:25, Nikolas Everett ha scritto:
> > > 
> > > > On Wed, Nov 12,  
> > > > 2014 at 8:15 AM, Alessandro Bonfanti \<[bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)\>  
> > > > wrote:
> > > > 
> > > > > Hi, I'm very newbie on ElasticSearch. 
> > > > > 
> > > > > ```
> > > > > I'm try to indexing a set of
> > > > > biological data. There are some fields
> > > > > like 'gene_id' or 'gene_shortname'
> > > > > that should be processed as literal
> > > > > strings.
> > > > > 
> > > > > When I try to search for 'ZNF6092' in
> > > > > a field filled with 'linc-ZNF6092-6',
> > > > > I can't find anything. When I search
> > > > > for 'linc' I find correct document
> > > > > elsewhere.
> > > > > 
> > > > > It seems that this is a problem with
> > > > > ES analyzer, but I tried to set it for
> > > > > do not analyze fields, but it seems
> > > > > that nothing changes.
> > > > > 
> > > > > I try with:
> > > > > 
> > > > > ```
> > > > > 
> > > > > `curl
> > > > > -XPOST
> > > > > 'localhost:9200/a3'-d @tracking_map.json`
> > > > > 
> > > > > `
> > > > > `
> > > > > 
> > > > > ```
> > > > > where tracking_map.json is
> > > > > 
> > > > > ```
> > > > > 
> > > > > `{`
> > > > > 
> > > > > `
> > > > > ```
> > > > > "mappings":{
> > > > > 
> > > > > "tracking":{
> > > > > 
> > > > > "properties":{
> > > > > 
> > > > > "tracking_id":{
> > > > > 
> > > > > "type":"string",
> > > > > 
> > > > > "index":"not_analyzed"
> > > > > 
> > > > > },
> > > > > 
> > > > > "nearest_ref_id":{
> > > > > 
> > > > > "type":"string",
> > > > > 
> > > > > "index":"not_analyzed"
> > > > > 
> > > > > },
> > > > > 
> > > > > "gene_id":{
> > > > > 
> > > > > "type":"string",
> > > > > 
> > > > > "index":"not_analyzed"
> > > > > 
> > > > > },
> > > > > 
> > > > > "gene_short_name":{
> > > > > 
> > > > > "type":"string",
> > > > > 
> > > > > "index":"not_analyzed"
> > > > > 
> > > > > }
> > > > > 
> > > > > }
> > > > > 
> > > > > }
> > > > > 
> > > > > }
> > > > > 
> > > > > ```
> > > > > }
> > > > > `
> > > > > 
> > > > > ```
> > > > > And then re-indexing of all documents.
> > > > > I failed, but where?
> > > > > 
> > > > > Thanks in advance,
> > > > > 
> > > > > Alessandro
> > > > > 
> > > > > ```
> > > > 
> > > > Its an analyzer problem, certainly.  
> > > > You've turned off analyzers with  
> > > > "index":"not\_analazyed". What you  
> > > > probably want is for the gene\_short\_name  
> > > > to be analyzed so that dashes are  
> > > > considered "word separators". If you do  
> > > > that you can find linc-ZNF6092-6 by  
> > > > performing a simple\_query\_string (or  
> > > > match) search for  
> > > > \<code\>ZNF6092\</code\> or  
> > > > \<code\>ZNF6092 6\</code\> or  
> > > > \<code\>6\</code\> or  
> > > > \<code\>linc\</code\>. Have a  
> > > > look at [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html)  
> > > > and go from there. You may also want to  
> > > > use a lowercase filter so you can search  
> > > > for \<code\>znf6092\</code\> and  
> > > > still find it.
> > > > 
> > > > This is a good read on how to change  
> > > > the mapping as well:
> > > > 
> > > > [http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/](http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/)
> > > > 
> > > > even if you don't need all the  
> > > > information in there it is nice to know.
> > > > 
> > > > ```
> > > > Nik
> > > > 
> > > > -- 
> > > > 
> > > > You received this message because you are subscribed
> > > > to a topic in the Google Groups "elasticsearch"
> > > > group.
> > > > 
> > > > To unsubscribe from this topic, visit <a moz-do-not-send="true" href="https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe" target="_blank">https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe</a>.
> > > > 
> > > > To unsubscribe from this group and all its topics,
> > > > send an email to <a moz-do-not-send="true" href="mailto:elasticsearch+unsubscribe@googlegroups.com" target="_blank">elasticsearch+unsubscribe@googlegroups.com</a>.
> > > > 
> > > > To view this discussion on the web visit <a moz-do-not-send="true" href="https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" target="_blank">https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com</a>.
> > > > 
> > > > For more options, visit <a moz-do-not-send="true" href="https://groups.google.com/d/optout" target="_blank">https://groups.google.com/d/optout</a>.
> > > > 
> > > > ```
> > > 
> > > Very thanks for your answer,
> > > 
> > > ```
> > > What I want is that ES store fields as literals, so I
> > > should find ZNF6092 with a wilcard search (*ZNF6092*
> > > for example).
> > > 
> > > I tried set "pattern" to "*" for testing (* isn't in
> > > gene_shortname, so I suppose that entire string is
> > > stored. But anyway I still find nothing.
> > > 
> > > ```
> > 
> > You'd have to post your queries for me to help more  
> > but in general if best to analyze the content up front  
> > and perform basic match queries without wildcards than  
> > it is to search with wildcards. Wildcards are way way  
> > way slower.
> > 
> > ```
> > Nik 
> > 
> > -- 
> > 
> > You received this message because you are subscribed to a topic
> > in the Google Groups "elasticsearch" group.
> > 
> > To unsubscribe from this topic, visit <a moz-do-not-send="true" href="https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe">https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe</a>.
> > 
> > To unsubscribe from this group and all its topics, send an email
> > to <a moz-do-not-send="true" href="mailto:elasticsearch+unsubscribe@googlegroups.com">elasticsearch+unsubscribe@googlegroups.com</a>.
> > 
> > To view this discussion on the web visit <a moz-do-not-send="true" href="https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0itbdHQ-maOuOmrrYf2QCqMFORTG21QpFHOCrp9E0rmg%40mail.gmail.com?utm_medium=email&amp;utm_source=footer">https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0itbdHQ-maOuOmrrYf2QCqMFORTG21QpFHOCrp9E0rmg%40mail.gmail.com</a>.
> > 
> > For more options, visit <a moz-do-not-send="true" href="https://groups.google.com/d/optout">https://groups.google.com/d/optout</a>.
> > 
> > ```
> 
> ```
> This is my query (in Ruby):
> 
> ```
> 
> ```
> @client.search index: @index, body: {query: {wildcard: {_all: query_text}}}
> ```
> 
> ```
> Variables' name should be auto-explicative of its content.
> 
> I read that wildcards are slower, if you have a more clean
> solution (I need anyway that I still can search for "linc-ZNF6092"
> in addiction for "ZNF6092") it will be very welcome. 
> 
> ```

 I have tried a lot of attempts, but the problem still resist. Maybe could it be caused by another setting than analyzer?

---

<div class="post-metadata">

**Author:** ![bnf\_lsn](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@bnf\_lsn](https://discuss.elastic.co/u/bnf_lsn)\
**Post date:** [January 21, 2015, 10:43am UTC](https://discuss.elastic.co/t/i-cant-find-anything-after-hypens-or-underscores/20705/7 "2015-01-21T10:43:59Z")

</div>

Il 02/12/2014 09:21, Alessandro  
Bonfanti ha scritto:

> Il 12/11/2014 17:43, Alessandro Bonfanti ha scritto:
> 
> > Il 12/11/2014 17:20, Nikolas Everett ha scritto:
> > 
> > > On Wed, Nov 12, 2014 at 11:13 AM,  
> > > Alessandro Bonfanti \<[bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)\>  
> > > wrote:
> > > 
> > > > Il 12/11/2014 15:25, Nikolas Everett ha scritto:
> > > > 
> > > > > On Wed, Nov 12,  
> > > > > 2014 at 8:15 AM, Alessandro Bonfanti \<[bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)\>  
> > > > > wrote:
> > > > > 
> > > > > > Hi, I'm very newbie on ElasticSearch. 
> > > > > > 
> > > > > > ```
> > > > > > I'm try to indexing a set of
> > > > > > biological data. There are some
> > > > > > fields like 'gene_id' or
> > > > > > 'gene_shortname' that should be
> > > > > > processed as literal strings.
> > > > > > 
> > > > > > When I try to search for 'ZNF6092'
> > > > > > in a field filled with
> > > > > > 'linc-ZNF6092-6', I can't find
> > > > > > anything. When I search for 'linc' I
> > > > > > find correct document elsewhere.
> > > > > > 
> > > > > > It seems that this is a problem with
> > > > > > ES analyzer, but I tried to set it
> > > > > > for do not analyze fields, but it
> > > > > > seems that nothing changes.
> > > > > > 
> > > > > > I try with:
> > > > > > 
> > > > > > ```
> > > > > > 
> > > > > > `curl`
> > > > > > 
> > > > > > `
> > > > > > ```
> > > > > > -XPOST
> > > > > > 
> > > > > > 'localhost:9200/a3'-d @tracking_map.json
> > > > > > 
> > > > > > ```
> > > > > > `
> > > > > > 
> > > > > > ```
> > > > > > where tracking_map.json is
> > > > > > 
> > > > > > ```
> > > > > > 
> > > > > > `{`
> > > > > > 
> > > > > > `
> > > > > > ```
> > > > > > "mappings":{
> > > > > > 
> > > > > > "tracking":{
> > > > > > 
> > > > > > "properties":{
> > > > > > 
> > > > > > "tracking_id":{
> > > > > > 
> > > > > > "type":"string",
> > > > > > 
> > > > > > "index":"not_analyzed"
> > > > > > 
> > > > > > },
> > > > > > 
> > > > > > "nearest_ref_id":{
> > > > > > 
> > > > > > "type":"string",
> > > > > > 
> > > > > > "index":"not_analyzed"
> > > > > > 
> > > > > > },
> > > > > > 
> > > > > > "gene_id":{
> > > > > > 
> > > > > > "type":"string",
> > > > > > 
> > > > > > "index":"not_analyzed"
> > > > > > 
> > > > > > },
> > > > > > 
> > > > > > "gene_short_name":{
> > > > > > 
> > > > > > "type":"string",
> > > > > > 
> > > > > > "index":"not_analyzed"
> > > > > > 
> > > > > > }
> > > > > > 
> > > > > > }
> > > > > > 
> > > > > > }
> > > > > > 
> > > > > > }
> > > > > > 
> > > > > > ```
> > > > > > }
> > > > > > `
> > > > > > 
> > > > > > ```
> > > > > > And then re-indexing of all
> > > > > > documents. I failed, but where?
> > > > > > 
> > > > > > Thanks in advance,
> > > > > > 
> > > > > > Alessandro
> > > > > > 
> > > > > > ```
> > > > > 
> > > > > Its an analyzer problem,  
> > > > > certainly. You've turned off  
> > > > > analyzers with  
> > > > > "index":"not\_analazyed". What you  
> > > > > probably want is for the  
> > > > > gene\_short\_name to be analyzed so that  
> > > > > dashes are considered "word  
> > > > > separators". If you do that you can  
> > > > > find linc-ZNF6092-6 by performing a  
> > > > > simple\_query\_string (or match) search  
> > > > > for \<code\>ZNF6092\</code\>  
> > > > > or \<code\>ZNF6092 6\</code\>  
> > > > > or \<code\>6\</code\> or  
> > > > > \<code\>linc\</code\>. Have  
> > > > > a look at [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html)  
> > > > > and go from there. You may also want  
> > > > > to use a lowercase filter so you can  
> > > > > search for  
> > > > > \<code\>znf6092\</code\> and  
> > > > > still find it.
> > > > > 
> > > > > This is a good read on how to  
> > > > > change the mapping as well:
> > > > > 
> > > > > [http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/](http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/)
> > > > > 
> > > > > even if you don't need all the  
> > > > > information in there it is nice to  
> > > > > know.
> > > > > 
> > > > > ```
> > > > > Nik
> > > > > 
> > > > > -- 
> > > > > 
> > > > > You received this message because you are
> > > > > subscribed to a topic in the Google Groups
> > > > > "elasticsearch" group.
> > > > > 
> > > > > To unsubscribe from this topic, visit <a moz-do-not-send="true" href="https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe" target="_blank">https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe</a>.
> > > > > 
> > > > > To unsubscribe from this group and all its topics,
> > > > > send an email to <a moz-do-not-send="true" href="mailto:elasticsearch+unsubscribe@googlegroups.com" target="_blank">elasticsearch+unsubscribe@googlegroups.com</a>.
> > > > > 
> > > > > To view this discussion on the web visit <a moz-do-not-send="true" href="https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" target="_blank">https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com</a>.
> > > > > 
> > > > > For more options, visit <a moz-do-not-send="true" href="https://groups.google.com/d/optout" target="_blank">https://groups.google.com/d/optout</a>.
> > > > > 
> > > > > ```
> > > > 
> > > > Very thanks for your answer,
> > > > 
> > > > ```
> > > > What I want is that ES store fields as literals, so
> > > > I should find ZNF6092 with a wilcard search
> > > > (*ZNF6092* for example).
> > > > 
> > > > I tried set "pattern" to "*" for testing (* isn't in
> > > > gene_shortname, so I suppose that entire string is
> > > > stored. But anyway I still find nothing.
> > > > 
> > > > ```
> > > 
> > > You'd have to post your queries for me to help more  
> > > but in general if best to analyze the content up front  
> > > and perform basic match queries without wildcards than  
> > > it is to search with wildcards. Wildcards are way way  
> > > way slower.
> > > 
> > > ```
> > > Nik 
> > > 
> > > -- 
> > > 
> > > You received this message because you are subscribed to a
> > > topic in the Google Groups "elasticsearch" group.
> > > 
> > > To unsubscribe from this topic, visit <a moz-do-not-send="true" href="https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe">https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe</a>.
> > > 
> > > To unsubscribe from this group and all its topics, send an
> > > email to <a moz-do-not-send="true" href="mailto:elasticsearch+unsubscribe@googlegroups.com">elasticsearch+unsubscribe@googlegroups.com</a>.
> > > 
> > > To view this discussion on the web visit <a moz-do-not-send="true" href="https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0itbdHQ-maOuOmrrYf2QCqMFORTG21QpFHOCrp9E0rmg%40mail.gmail.com?utm_medium=email&amp;utm_source=footer">https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0itbdHQ-maOuOmrrYf2QCqMFORTG21QpFHOCrp9E0rmg%40mail.gmail.com</a>.
> > > 
> > > For more options, visit <a moz-do-not-send="true" href="https://groups.google.com/d/optout">https://groups.google.com/d/optout</a>.
> > > 
> > > ```
> > 
> > ```
> > This is my query (in Ruby):
> > 
> > ```
> > 
> > ```
> > @client.search index: @index, body: {query: {wildcard: {_all: query_text}}}
> > ```
> > 
> > ```
> > Variables' name should be auto-explicative of its content.
> > 
> > I read that wildcards are slower, if you have a more clean
> > solution (I need anyway that I still can search for
> > "linc-ZNF6092" in addiction for "ZNF6092") it will be very
> > welcome. 
> > 
> > ```
> 
> I have tried a lot of attempts, but the problem still resist. Maybe could it be caused by another setting than analyzer?

```
Definitely, I need a step-to-step method for disabling the analyzer
or set it to 'keyword' on all fields of an index. I tried a lot of
attempts but no-one seems to work.

This situation cause me much problems, I need that ES do not
tokenize my literal strings, why there isn't a clear method to
switch of it?

Thanks everyones.

```

---

<div class="post-metadata">

**Author:** ![bnf\_lsn](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@bnf\_lsn](https://discuss.elastic.co/u/bnf_lsn)\
**Post date:** [January 26, 2015, 3:37pm UTC](https://discuss.elastic.co/t/i-cant-find-anything-after-hypens-or-underscores/20705/8 "2015-01-26T15:37:12Z")

</div>

Il 21/01/2015 11:43, Alessandro  
Bonfanti ha scritto:

> Il 02/12/2014 09:21, Alessandro Bonfanti ha scritto:
> 
> > Il 12/11/2014 17:43, Alessandro Bonfanti ha scritto:
> > 
> > > Il 12/11/2014 17:20, Nikolas Everett ha scritto:
> > > 
> > > > On Wed, Nov 12, 2014 at 11:13  
> > > > AM, Alessandro Bonfanti \<[bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)\>  
> > > > wrote:
> > > > 
> > > > > Il 12/11/2014 15:25, Nikolas Everett ha scritto:
> > > > > 
> > > > > > On Wed, Nov 12,  
> > > > > > 2014 at 8:15 AM, Alessandro Bonfanti \<[bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)\>  
> > > > > > wrote:
> > > > > > 
> > > > > > > Hi, I'm very newbie on ElasticSearch. 
> > > > > > > 
> > > > > > > ```
> > > > > > > I'm try to indexing a set of
> > > > > > > biological data. There are some
> > > > > > > fields like 'gene_id' or
> > > > > > > 'gene_shortname' that should be
> > > > > > > processed as literal strings.
> > > > > > > 
> > > > > > > When I try to search for 'ZNF6092'
> > > > > > > in a field filled with
> > > > > > > 'linc-ZNF6092-6', I can't find
> > > > > > > anything. When I search for 'linc'
> > > > > > > I find correct document elsewhere.
> > > > > > > 
> > > > > > > It seems that this is a problem
> > > > > > > with ES analyzer, but I tried to
> > > > > > > set it for do not analyze fields,
> > > > > > > but it seems that nothing changes.
> > > > > > > 
> > > > > > > I try with:
> > > > > > > 
> > > > > > > ```
> > > > > > > 
> > > > > > > `curl`
> > > > > > > 
> > > > > > > `
> > > > > > > ```
> > > > > > > -XPOST
> > > > > > > 
> > > > > > > 'localhost:9200/a3'-d
> > > > > > > @tracking_map.json
> > > > > > > 
> > > > > > > ```
> > > > > > > `
> > > > > > > 
> > > > > > > ```
> > > > > > > where tracking_map.json is
> > > > > > > 
> > > > > > > ```
> > > > > > > 
> > > > > > > `{`
> > > > > > > 
> > > > > > > `
> > > > > > > ```
> > > > > > > "mappings":{
> > > > > > > 
> > > > > > > "tracking":{
> > > > > > > 
> > > > > > > "properties":{
> > > > > > > 
> > > > > > > "tracking_id":{
> > > > > > > 
> > > > > > > "type":"string",
> > > > > > > 
> > > > > > > "index":"not_analyzed"
> > > > > > > 
> > > > > > > },
> > > > > > > 
> > > > > > > "nearest_ref_id":{
> > > > > > > 
> > > > > > > "type":"string",
> > > > > > > 
> > > > > > > "index":"not_analyzed"
> > > > > > > 
> > > > > > > },
> > > > > > > 
> > > > > > > "gene_id":{
> > > > > > > 
> > > > > > > "type":"string",
> > > > > > > 
> > > > > > > "index":"not_analyzed"
> > > > > > > 
> > > > > > > },
> > > > > > > 
> > > > > > > "gene_short_name":{
> > > > > > > 
> > > > > > > "type":"string",
> > > > > > > 
> > > > > > > "index":"not_analyzed"
> > > > > > > 
> > > > > > > }
> > > > > > > 
> > > > > > > }
> > > > > > > 
> > > > > > > }
> > > > > > > 
> > > > > > > }
> > > > > > > 
> > > > > > > ```
> > > > > > > }
> > > > > > > `
> > > > > > > 
> > > > > > > ```
> > > > > > > And then re-indexing of all
> > > > > > > documents. I failed, but where?
> > > > > > > 
> > > > > > > Thanks in advance,
> > > > > > > 
> > > > > > > Alessandro
> > > > > > > 
> > > > > > > ```
> > > > > > 
> > > > > > Its an analyzer problem,  
> > > > > > certainly. You've turned off  
> > > > > > analyzers with  
> > > > > > "index":"not\_analazyed". What you  
> > > > > > probably want is for the  
> > > > > > gene\_short\_name to be analyzed so  
> > > > > > that dashes are considered "word  
> > > > > > separators". If you do that you can  
> > > > > > find linc-ZNF6092-6 by performing a  
> > > > > > simple\_query\_string (or match)  
> > > > > > search for  
> > > > > > \<code\>ZNF6092\</code\> or  
> > > > > > \<code\>ZNF6092 6\</code\>  
> > > > > > or \<code\>6\</code\> or  
> > > > > > \<code\>linc\</code\>.  
> > > > > > Have a look at [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html)  
> > > > > > and go from there. You may also  
> > > > > > want to use a lowercase filter so  
> > > > > > you can search for  
> > > > > > \<code\>znf6092\</code\> and  
> > > > > > still find it.
> > > > > > 
> > > > > > This is a good read on how to  
> > > > > > change the mapping as well:
> > > > > > 
> > > > > > [http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/](http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/)
> > > > > > 
> > > > > > even if you don't need all the  
> > > > > > information in there it is nice to  
> > > > > > know.
> > > > > > 
> > > > > > ```
> > > > > > Nik
> > > > > > 
> > > > > > -- 
> > > > > > 
> > > > > > You received this message because you are
> > > > > > subscribed to a topic in the Google Groups
> > > > > > "elasticsearch" group.
> > > > > > 
> > > > > > To unsubscribe from this topic, visit <a moz-do-not-send="true" href="https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe" target="_blank">https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe</a>.
> > > > > > 
> > > > > > To unsubscribe from this group and all its
> > > > > > topics, send an email to <a moz-do-not-send="true" href="mailto:elasticsearch+unsubscribe@googlegroups.com" target="_blank">elasticsearch+unsubscribe@googlegroups.com</a>.
> > > > > > 
> > > > > > To view this discussion on the web visit <a moz-do-not-send="true" href="https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" target="_blank">https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com</a>.
> > > > > > 
> > > > > > For more options, visit <a moz-do-not-send="true" href="https://groups.google.com/d/optout" target="_blank">https://groups.google.com/d/optout</a>.
> > > > > > 
> > > > > > ```
> > > > > 
> > > > > Very thanks for your answer,
> > > > > 
> > > > > ```
> > > > > What I want is that ES store fields as literals,
> > > > > so I should find ZNF6092 with a wilcard search
> > > > > (*ZNF6092* for example).
> > > > > 
> > > > > I tried set "pattern" to "*" for testing (* isn't
> > > > > in gene_shortname, so I suppose that entire string
> > > > > is stored. But anyway I still find nothing.
> > > > > 
> > > > > ```
> > > > 
> > > > You'd have to post your queries for me to help  
> > > > more but in general if best to analyze the content  
> > > > up front and perform basic match queries without  
> > > > wildcards than it is to search with wildcards.  
> > > > Wildcards are way way way slower.
> > > > 
> > > > ```
> > > > Nik 
> > > > 
> > > > -- 
> > > > 
> > > > You received this message because you are subscribed to a
> > > > topic in the Google Groups "elasticsearch" group.
> > > > 
> > > > To unsubscribe from this topic, visit <a moz-do-not-send="true" href="https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe">https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe</a>.
> > > > 
> > > > To unsubscribe from this group and all its topics, send an
> > > > email to <a moz-do-not-send="true" href="mailto:elasticsearch+unsubscribe@googlegroups.com">elasticsearch+unsubscribe@googlegroups.com</a>.
> > > > 
> > > > To view this discussion on the web visit <a moz-do-not-send="true" href="https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0itbdHQ-maOuOmrrYf2QCqMFORTG21QpFHOCrp9E0rmg%40mail.gmail.com?utm_medium=email&amp;utm_source=footer">https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0itbdHQ-maOuOmrrYf2QCqMFORTG21QpFHOCrp9E0rmg%40mail.gmail.com</a>.
> > > > 
> > > > For more options, visit <a moz-do-not-send="true" href="https://groups.google.com/d/optout">https://groups.google.com/d/optout</a>.
> > > > 
> > > > ```
> > > 
> > > ```
> > > This is my query (in Ruby):
> > > 
> > > ```
> > > 
> > > ```
> > > @client.search index: @index, body: {query: {wildcard: {_all: query_text}}}
> > > ```
> > > 
> > > ```
> > > Variables' name should be auto-explicative of its content.
> > > 
> > > I read that wildcards are slower, if you have a more clean
> > > solution (I need anyway that I still can search for
> > > "linc-ZNF6092" in addiction for "ZNF6092") it will be very
> > > welcome. 
> > > 
> > > ```
> > 
> > I have tried a lot of attempts, but the problem still resist. Maybe could it be caused by another setting than analyzer?
> 
> ```
> Definitely, I need a step-to-step method for disabling the
> analyzer or set it to 'keyword' on all fields of an index. I tried
> a lot of attempts but no-one seems to work.
> 
> This situation cause me much problems, I need that ES do not
> tokenize my literal strings, why there isn't a clear method to
> switch of it?
> 
> Thanks everyones.
> 
> ```

```
OK, after a lot of attempts I can finally set analyezer to 'keyword'
for default. I do this with:

```

```
@es_client.indices.create index: "test", body: { "index" => { "analysis" => { "analyzer" => { "default" => { "type" => "keyword" }}}}}
```

```
Now I have solved some problems, I finally can do exact matching
stuff with 'term' query, for example on a path '/home/data/foo.bar'
or on a gene-id 'ENSG00000186092'.

The bad things are that problems with 'query_string' even worsen. It
seems that query_string can't work with not analyzed fields.

If I try a trivial:

```

```
@es_client.search index: "test", body: {"query" => { "query_string" => { "query" => "ENSG00000186092" }}}
```

```
Nothing works (0 results found). Text hasn't spaces or other special
characters that could create problems with tokenization. So what's
the problem?

Can a solution be the use of a 'fake' pattern tokenizer with pattern
"$^" (this should create a non-matchable pattern, with result alike
the 'keyword' analyzer)?

Any other idea will be very appreciated. 

```

```

```

---

<div class="post-metadata">

**Author:** ![bnf\_lsn](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@bnf\_lsn](https://discuss.elastic.co/u/bnf_lsn)\
**Post date:** [January 28, 2015, 9:58am UTC](https://discuss.elastic.co/t/i-cant-find-anything-after-hypens-or-underscores/20705/9 "2015-01-28T09:58:30Z")

</div>

Il 26/01/2015 16:37, Alessandro  
Bonfanti ha scritto:

> Il 21/01/2015 11:43, Alessandro Bonfanti ha scritto:
> 
> > Il 02/12/2014 09:21, Alessandro Bonfanti ha scritto:
> > 
> > > Il 12/11/2014 17:43, Alessandro Bonfanti ha scritto:
> > > 
> > > > Il 12/11/2014 17:20, Nikolas Everett ha scritto:
> > > > 
> > > > > On Wed, Nov 12, 2014 at 11:13  
> > > > > AM, Alessandro Bonfanti \<[bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)\>  
> > > > > wrote:
> > > > > 
> > > > > > Il 12/11/2014 15:25, Nikolas Everett ha scritto:
> > > > > > 
> > > > > > > On Wed, Nov  
> > > > > > > 12, 2014 at 8:15 AM, Alessandro  
> > > > > > > Bonfanti \<[bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)\>  
> > > > > > > wrote:
> > > > > > > 
> > > > > > > > Hi, I'm very newbie on ElasticSearch. 
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > I'm try to indexing a set of
> > > > > > > > biological data. There are some
> > > > > > > > fields like 'gene_id' or
> > > > > > > > 'gene_shortname' that should be
> > > > > > > > processed as literal strings.
> > > > > > > > 
> > > > > > > > When I try to search for
> > > > > > > > 'ZNF6092' in a field filled with
> > > > > > > > 'linc-ZNF6092-6', I can't find
> > > > > > > > anything. When I search for
> > > > > > > > 'linc' I find correct document
> > > > > > > > elsewhere.
> > > > > > > > 
> > > > > > > > It seems that this is a problem
> > > > > > > > with ES analyzer, but I tried to
> > > > > > > > set it for do not analyze
> > > > > > > > fields, but it seems that
> > > > > > > > nothing changes.
> > > > > > > > 
> > > > > > > > I try with:
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > 
> > > > > > > > `curl`
> > > > > > > > 
> > > > > > > > `
> > > > > > > > ```
> > > > > > > > -XPOST
> > > > > > > > 
> > > > > > > > 'localhost:9200/a3'-d
> > > > > > > > @tracking_map.json
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > `
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > where tracking_map.json is
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > 
> > > > > > > > `{`
> > > > > > > > 
> > > > > > > > `
> > > > > > > > ```
> > > > > > > > "mappings":{
> > > > > > > > 
> > > > > > > > "tracking":{
> > > > > > > > 
> > > > > > > > "properties":{
> > > > > > > > 
> > > > > > > > "tracking_id":{
> > > > > > > > 
> > > > > > > > "type":"string",
> > > > > > > > 
> > > > > > > > "index":"not_analyzed"
> > > > > > > > 
> > > > > > > > },
> > > > > > > > 
> > > > > > > > "nearest_ref_id":{
> > > > > > > > 
> > > > > > > > "type":"string",
> > > > > > > > 
> > > > > > > > "index":"not_analyzed"
> > > > > > > > 
> > > > > > > > },
> > > > > > > > 
> > > > > > > > "gene_id":{
> > > > > > > > 
> > > > > > > > "type":"string",
> > > > > > > > 
> > > > > > > > "index":"not_analyzed"
> > > > > > > > 
> > > > > > > > },
> > > > > > > > 
> > > > > > > > "gene_short_name":{
> > > > > > > > 
> > > > > > > > "type":"string",
> > > > > > > > 
> > > > > > > > "index":"not_analyzed"
> > > > > > > > 
> > > > > > > > }
> > > > > > > > 
> > > > > > > > }
> > > > > > > > 
> > > > > > > > }
> > > > > > > > 
> > > > > > > > }
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > }
> > > > > > > > `
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > And then re-indexing of all
> > > > > > > > documents. I failed, but where?
> > > > > > > > 
> > > > > > > > Thanks in advance,
> > > > > > > > 
> > > > > > > > Alessandro
> > > > > > > > 
> > > > > > > > ```
> > > > > > > 
> > > > > > > Its an analyzer problem,  
> > > > > > > certainly. You've turned off  
> > > > > > > analyzers with  
> > > > > > > "index":"not\_analazyed". What you  
> > > > > > > probably want is for the  
> > > > > > > gene\_short\_name to be analyzed so  
> > > > > > > that dashes are considered "word  
> > > > > > > separators". If you do that you  
> > > > > > > can find linc-ZNF6092-6 by  
> > > > > > > performing a simple\_query\_string  
> > > > > > > (or match) search for  
> > > > > > > \<code\>ZNF6092\</code\>  
> > > > > > > or \<code\>ZNF6092  
> > > > > > > 6\</code\> or  
> > > > > > > \<code\>6\</code\> or  
> > > > > > > \<code\>linc\</code\>.  
> > > > > > > Have a look at [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html)  
> > > > > > > and go from there. You may also  
> > > > > > > want to use a lowercase filter so  
> > > > > > > you can search for  
> > > > > > > \<code\>znf6092\</code\>  
> > > > > > > and still find it.
> > > > > > > 
> > > > > > > This is a good read on how to  
> > > > > > > change the mapping as well:
> > > > > > > 
> > > > > > > [http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/](http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/)
> > > > > > > 
> > > > > > > even if you don't need all the  
> > > > > > > information in there it is nice to  
> > > > > > > know.
> > > > > > > 
> > > > > > > ```
> > > > > > > Nik
> > > > > > > 
> > > > > > > -- 
> > > > > > > 
> > > > > > > You received this message because you are
> > > > > > > subscribed to a topic in the Google Groups
> > > > > > > "elasticsearch" group.
> > > > > > > 
> > > > > > > To unsubscribe from this topic, visit <a moz-do-not-send="true" href="https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe" target="_blank">https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe</a>.
> > > > > > > 
> > > > > > > To unsubscribe from this group and all its
> > > > > > > topics, send an email to <a moz-do-not-send="true" href="mailto:elasticsearch+unsubscribe@googlegroups.com" target="_blank">elasticsearch+unsubscribe@googlegroups.com</a>.
> > > > > > > 
> > > > > > > To view this discussion on the web visit <a moz-do-not-send="true" href="https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" target="_blank">https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com</a>.
> > > > > > > 
> > > > > > > For more options, visit <a moz-do-not-send="true" href="https://groups.google.com/d/optout" target="_blank">https://groups.google.com/d/optout</a>.
> > > > > > > 
> > > > > > > ```
> > > > > > 
> > > > > > Very thanks for your answer,
> > > > > > 
> > > > > > ```
> > > > > > What I want is that ES store fields as literals,
> > > > > > so I should find ZNF6092 with a wilcard search
> > > > > > (*ZNF6092* for example).
> > > > > > 
> > > > > > I tried set "pattern" to "*" for testing (*
> > > > > > isn't in gene_shortname, so I suppose that
> > > > > > entire string is stored. But anyway I still find
> > > > > > nothing.
> > > > > > 
> > > > > > ```
> > > > > 
> > > > > You'd have to post your queries for me to help  
> > > > > more but in general if best to analyze the content  
> > > > > up front and perform basic match queries without  
> > > > > wildcards than it is to search with wildcards.  
> > > > > Wildcards are way way way slower.
> > > > > 
> > > > > ```
> > > > > Nik 
> > > > > 
> > > > > -- 
> > > > > 
> > > > > You received this message because you are subscribed to a
> > > > > topic in the Google Groups "elasticsearch" group.
> > > > > 
> > > > > To unsubscribe from this topic, visit <a moz-do-not-send="true" href="https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe">https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe</a>.
> > > > > 
> > > > > To unsubscribe from this group and all its topics, send an
> > > > > email to <a moz-do-not-send="true" href="mailto:elasticsearch+unsubscribe@googlegroups.com">elasticsearch+unsubscribe@googlegroups.com</a>.
> > > > > 
> > > > > To view this discussion on the web visit <a moz-do-not-send="true" href="https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0itbdHQ-maOuOmrrYf2QCqMFORTG21QpFHOCrp9E0rmg%40mail.gmail.com?utm_medium=email&amp;utm_source=footer">https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0itbdHQ-maOuOmrrYf2QCqMFORTG21QpFHOCrp9E0rmg%40mail.gmail.com</a>.
> > > > > 
> > > > > For more options, visit <a moz-do-not-send="true" href="https://groups.google.com/d/optout">https://groups.google.com/d/optout</a>.
> > > > > 
> > > > > ```
> > > > 
> > > > ```
> > > > This is my query (in Ruby):
> > > > 
> > > > ```
> > > > 
> > > > ```
> > > > @client.search index: @index, body: {query: {wildcard: {_all: query_text}}}
> > > > ```
> > > > 
> > > > ```
> > > > Variables' name should be auto-explicative of its content.
> > > > 
> > > > I read that wildcards are slower, if you have a more clean
> > > > solution (I need anyway that I still can search for
> > > > "linc-ZNF6092" in addiction for "ZNF6092") it will be very
> > > > welcome. 
> > > > 
> > > > ```
> > > 
> > > I have tried a lot of attempts, but the problem still resist. Maybe could it be caused by another setting than analyzer?
> > 
> > ```
> > Definitely, I need a step-to-step method for disabling the
> > analyzer or set it to 'keyword' on all fields of an index. I
> > tried a lot of attempts but no-one seems to work.
> > 
> > This situation cause me much problems, I need that ES do not
> > tokenize my literal strings, why there isn't a clear method to
> > switch of it?
> > 
> > Thanks everyones.
> > 
> > ```
> 
> ```
> OK, after a lot of attempts I can finally set analyezer to
> 'keyword' for default. I do this with:
> 
> ```
> 
> ```
> @es_client.indices.create index: "test", body: { "index" => { "analysis" => { "analyzer" => { "default" => { "type" => "keyword" }}}}}
> ```
> 
> ```
> Now I have solved some problems, I finally can do exact matching
> stuff with 'term' query, for example on a path
> '/home/data/foo.bar' or on a gene-id 'ENSG00000186092'.
> 
> The bad things are that problems with 'query_string' even worsen.
> It seems that query_string can't work with not analyzed fields.
> 
> If I try a trivial:
> 
> ```
> 
> ```
> @es_client.search index: "test", body: {"query" => { "query_string" => { "query" => "ENSG00000186092" }}}
> ```
> 
> ```
> Nothing works (0 results found). Text hasn't spaces or other
> special characters that could create problems with tokenization.
> So what's the problem?
> 
> Can a solution be the use of a 'fake' pattern tokenizer with
> pattern "$^" (this should create a non-matchable pattern, with
> result alike the 'keyword' analyzer)?
> 
> Any other idea will be very appreciated. 
> 
> ```

 Problems with search derived probably by the fact that query\_string automatically make lovercased all words. It's behavior caused by 'lowercase' filter automatically inserted. 

```
I can't find on the web any examples about setting of
analyzers/tokenizers/filters via ruby APIs. The only one that seems
to work well is the pulled over method for set the default analyzer
when a new index is created. Any suggestion?

I need valid method for set them in custom fields/searches etc.

```

---

<div class="post-metadata">

**Author:** ![bnf\_lsn](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@bnf\_lsn](https://discuss.elastic.co/u/bnf_lsn)\
**Post date:** [January 30, 2015, 11:00am UTC](https://discuss.elastic.co/t/i-cant-find-anything-after-hypens-or-underscores/20705/10 "2015-01-30T11:00:54Z")

</div>

Il 28/01/2015 10:58, Alessandro  
Bonfanti ha scritto:

> Il 26/01/2015 16:37, Alessandro Bonfanti ha scritto:
> 
> > Il 21/01/2015 11:43, Alessandro Bonfanti ha scritto:
> > 
> > > Il 02/12/2014 09:21, Alessandro Bonfanti ha scritto:
> > > 
> > > > Il 12/11/2014 17:43, Alessandro Bonfanti ha scritto:
> > > > 
> > > > > Il 12/11/2014 17:20, Nikolas Everett ha scritto:
> > > > > 
> > > > > > On Wed, Nov 12, 2014 at  
> > > > > > 11:13 AM, Alessandro Bonfanti \<[bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)\>  
> > > > > > wrote:
> > > > > > 
> > > > > > > Il 12/11/2014 15:25, Nikolas Everett ha scritto:
> > > > > > > 
> > > > > > > > On Wed, Nov  
> > > > > > > > 12, 2014 at 8:15 AM, Alessandro  
> > > > > > > > Bonfanti \<[bnf.lsn@gmail.com](mailto:bnf.lsn@gmail.com)\>  
> > > > > > > > wrote:
> > > > > > > > 
> > > > > > > > > Hi, I'm very newbie on ElasticSearch. 
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > I'm try to indexing a set of
> > > > > > > > > biological data. There are
> > > > > > > > > some fields like 'gene_id' or
> > > > > > > > > 'gene_shortname' that should
> > > > > > > > > be processed as literal
> > > > > > > > > strings.
> > > > > > > > > 
> > > > > > > > > When I try to search for
> > > > > > > > > 'ZNF6092' in a field filled
> > > > > > > > > with 'linc-ZNF6092-6', I can't
> > > > > > > > > find anything. When I search
> > > > > > > > > for 'linc' I find correct
> > > > > > > > > document elsewhere.
> > > > > > > > > 
> > > > > > > > > It seems that this is a
> > > > > > > > > problem with ES analyzer, but
> > > > > > > > > I tried to set it for do not
> > > > > > > > > analyze fields, but it seems
> > > > > > > > > that nothing changes.
> > > > > > > > > 
> > > > > > > > > I try with:
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > 
> > > > > > > > > `curl`
> > > > > > > > > 
> > > > > > > > > `
> > > > > > > > > ```
> > > > > > > > > -XPOST 'localhost:9200/a3'-d @tracking_map.json
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > `
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > where tracking_map.json is
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > 
> > > > > > > > > `{`
> > > > > > > > > 
> > > > > > > > > `
> > > > > > > > > ```
> > > > > > > > > "mappings":{
> > > > > > > > > 
> > > > > > > > > "tracking":{
> > > > > > > > > 
> > > > > > > > > "properties":{
> > > > > > > > > 
> > > > > > > > > "tracking_id":{
> > > > > > > > > 
> > > > > > > > > "type":"string",
> > > > > > > > > 
> > > > > > > > > "index":"not_analyzed"
> > > > > > > > > 
> > > > > > > > > },
> > > > > > > > > 
> > > > > > > > > "nearest_ref_id":{
> > > > > > > > > 
> > > > > > > > > "type":"string",
> > > > > > > > > 
> > > > > > > > > "index":"not_analyzed"
> > > > > > > > > 
> > > > > > > > > },
> > > > > > > > > 
> > > > > > > > > "gene_id":{
> > > > > > > > > 
> > > > > > > > > "type":"string",
> > > > > > > > > 
> > > > > > > > > "index":"not_analyzed"
> > > > > > > > > 
> > > > > > > > > },
> > > > > > > > > 
> > > > > > > > > "gene_short_name":{
> > > > > > > > > 
> > > > > > > > > "type":"string",
> > > > > > > > > 
> > > > > > > > > "index":"not_analyzed"
> > > > > > > > > 
> > > > > > > > > }
> > > > > > > > > 
> > > > > > > > > }
> > > > > > > > > 
> > > > > > > > > }
> > > > > > > > > 
> > > > > > > > > }
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > }
> > > > > > > > > `
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > And then re-indexing of all
> > > > > > > > > documents. I failed, but
> > > > > > > > > where?
> > > > > > > > > 
> > > > > > > > > Thanks in advance,
> > > > > > > > > 
> > > > > > > > > Alessandro
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > 
> > > > > > > > Its an analyzer problem,  
> > > > > > > > certainly. You've turned off  
> > > > > > > > analyzers with  
> > > > > > > > "index":"not\_analazyed". What  
> > > > > > > > you probably want is for the  
> > > > > > > > gene\_short\_name to be analyzed  
> > > > > > > > so that dashes are considered  
> > > > > > > > "word separators". If you do  
> > > > > > > > that you can find linc-ZNF6092-6  
> > > > > > > > by performing a  
> > > > > > > > simple\_query\_string (or match)  
> > > > > > > > search for  
> > > > > > > > \<code\>ZNF6092\</code\>  
> > > > > > > > or \<code\>ZNF6092  
> > > > > > > > 6\</code\> or  
> > > > > > > > \<code\>6\</code\> or  
> > > > > > > > \<code\>linc\</code\>.  
> > > > > > > > Have a look at [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-pattern-tokenizer.html)  
> > > > > > > > and go from there. You may also  
> > > > > > > > want to use a lowercase filter  
> > > > > > > > so you can search for  
> > > > > > > > \<code\>znf6092\</code\>  
> > > > > > > > and still find it.
> > > > > > > > 
> > > > > > > > This is a good read on how to  
> > > > > > > > change the mapping as well:
> > > > > > > > 
> > > > > > > > [http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/](http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/)
> > > > > > > > 
> > > > > > > > even if you don't need all  
> > > > > > > > the information in there it is  
> > > > > > > > nice to know.
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > Nik
> > > > > > > > 
> > > > > > > > -- 
> > > > > > > > 
> > > > > > > > You received this message because you are
> > > > > > > > subscribed to a topic in the Google Groups
> > > > > > > > "elasticsearch" group.
> > > > > > > > 
> > > > > > > > To unsubscribe from this topic, visit <a moz-do-not-send="true" href="https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe" target="_blank">https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe</a>.
> > > > > > > > 
> > > > > > > > To unsubscribe from this group and all its
> > > > > > > > topics, send an email to <a moz-do-not-send="true" href="mailto:elasticsearch+unsubscribe@googlegroups.com" target="_blank">elasticsearch+unsubscribe@googlegroups.com</a>.
> > > > > > > > 
> > > > > > > > To view this discussion on the web visit <a moz-do-not-send="true" href="https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" target="_blank">https://groups.google.com/d/msgid/elasticsearch/CAPmjWd06sKTVS6JC8q7x7R37gUEnsHEiuar0-yy_ZdOJQhKYzQ%40mail.gmail.com</a>.
> > > > > > > > 
> > > > > > > > For more options, visit <a moz-do-not-send="true" href="https://groups.google.com/d/optout" target="_blank">https://groups.google.com/d/optout</a>.
> > > > > > > > 
> > > > > > > > ```
> > > > > > > 
> > > > > > > Very thanks for your answer,
> > > > > > > 
> > > > > > > ```
> > > > > > > What I want is that ES store fields as
> > > > > > > literals, so I should find ZNF6092 with a
> > > > > > > wilcard search (*ZNF6092* for example).
> > > > > > > 
> > > > > > > I tried set "pattern" to "*" for testing (*
> > > > > > > isn't in gene_shortname, so I suppose that
> > > > > > > entire string is stored. But anyway I still
> > > > > > > find nothing.
> > > > > > > 
> > > > > > > ```
> > > > > > 
> > > > > > You'd have to post your queries for me to  
> > > > > > help more but in general if best to analyze the  
> > > > > > content up front and perform basic match queries  
> > > > > > without wildcards than it is to search with  
> > > > > > wildcards. Wildcards are way way way slower.
> > > > > > 
> > > > > > ```
> > > > > > Nik 
> > > > > > 
> > > > > > -- 
> > > > > > 
> > > > > > You received this message because you are subscribed to
> > > > > > a topic in the Google Groups "elasticsearch" group.
> > > > > > 
> > > > > > To unsubscribe from this topic, visit <a moz-do-not-send="true" href="https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe">https://groups.google.com/d/topic/elasticsearch/Y6I2qNZxR-s/unsubscribe</a>.
> > > > > > 
> > > > > > To unsubscribe from this group and all its topics, send
> > > > > > an email to <a moz-do-not-send="true" href="mailto:elasticsearch+unsubscribe@googlegroups.com">elasticsearch+unsubscribe@googlegroups.com</a>.
> > > > > > 
> > > > > > To view this discussion on the web visit <a moz-do-not-send="true" href="https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0itbdHQ-maOuOmrrYf2QCqMFORTG21QpFHOCrp9E0rmg%40mail.gmail.com?utm_medium=email&amp;utm_source=footer">https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0itbdHQ-maOuOmrrYf2QCqMFORTG21QpFHOCrp9E0rmg%40mail.gmail.com</a>.
> > > > > > 
> > > > > > For more options, visit <a moz-do-not-send="true" href="https://groups.google.com/d/optout">https://groups.google.com/d/optout</a>.
> > > > > > 
> > > > > > ```
> > > > > 
> > > > > ```
> > > > > This is my query (in Ruby):
> > > > > 
> > > > > ```
> > > > > 
> > > > > ```
> > > > > @client.search index: @index, body: {query: {wildcard: {_all: query_text}}}
> > > > > ```
> > > > > 
> > > > > ```
> > > > > Variables' name should be auto-explicative of its content.
> > > > > 
> > > > > I read that wildcards are slower, if you have a more clean
> > > > > solution (I need anyway that I still can search for
> > > > > "linc-ZNF6092" in addiction for "ZNF6092") it will be very
> > > > > welcome. 
> > > > > 
> > > > > ```
> > > > 
> > > > I have tried a lot of attempts, but the problem still resist. Maybe could it be caused by another setting than analyzer?
> > > 
> > > ```
> > > Definitely, I need a step-to-step method for disabling the
> > > analyzer or set it to 'keyword' on all fields of an index. I
> > > tried a lot of attempts but no-one seems to work.
> > > 
> > > This situation cause me much problems, I need that ES do not
> > > tokenize my literal strings, why there isn't a clear method to
> > > switch of it?
> > > 
> > > Thanks everyones.
> > > 
> > > ```
> > 
> > ```
> > OK, after a lot of attempts I can finally set analyezer to
> > 'keyword' for default. I do this with:
> > 
> > ```
> > 
> > ```
> > @es_client.indices.create index: "test", body: { "index" => { "analysis" => { "analyzer" => { "default" => { "type" => "keyword" }}}}}
> > ```
> > 
> > ```
> > Now I have solved some problems, I finally can do exact matching
> > stuff with 'term' query, for example on a path
> > '/home/data/foo.bar' or on a gene-id 'ENSG00000186092'.
> > 
> > The bad things are that problems with 'query_string' even
> > worsen. It seems that query_string can't work with not analyzed
> > fields.
> > 
> > If I try a trivial:
> > 
> > ```
> > 
> > ```
> > @es_client.search index: "test", body: {"query" => { "query_string" => { "query" => "ENSG00000186092" }}}
> > ```
> > 
> > ```
> > Nothing works (0 results found). Text hasn't spaces or other
> > special characters that could create problems with tokenization.
> > So what's the problem?
> > 
> > Can a solution be the use of a 'fake' pattern tokenizer with
> > pattern "$^" (this should create a non-matchable pattern, with
> > result alike the 'keyword' analyzer)?
> > 
> > Any other idea will be very appreciated. 
> > 
> > ```
> 
> Problems with search derived probably by the fact that query\_string automatically make lovercased all words. It's behavior caused by 'lowercase' filter automatically inserted. 
> 
> ```
> I can't find on the web any examples about setting of
> analyzers/tokenizers/filters via ruby APIs. The only one that
> seems to work well is the pulled over method for set the default
> analyzer when a new index is created. Any suggestion?
> 
> I need valid method for set them in custom fields/searches etc.  
> 
> ```

```
I successfully fix one problem: now I can set 'keyword' analyzer for
only some fields. I do this launching:

```

```
@Client.indices.put_mapping index: index_name, type: '_default_', body: {
	_default_: {
		properties: {
			position: {
				properties: {
					"dir" => {
						"type" => "string",
						"analyzer" => "keyword"
					},
					"name" => {
						"type" => "string",
						"analyzer" => "keyword"
					},
					"extension" => {
						"type" => "string",
						"analyzer" => "keyword"
					}
				}
			}
		}                             
	}
}
```

```
after index creation.

Previously this didn't work because I'd set 'dir', 'name' and
'extension' fields like flat fields (without their parent
'position'): I did that way because in searching process with 'term'
query, it needs flatten fields.  

I hope this post can be useful for ES newbies like me; mapping,
analyzing and tokening in Ruby APIs are documented very badly.

```

```

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:35am UTC](https://discuss.elastic.co/t/i-cant-find-anything-after-hypens-or-underscores/20705/11 "2017-07-06T00:35:42Z")

</div>


