# String with numbers fails

**URL:** <https://discuss.elastic.co/t/string-with-numbers-fails/11552>\
**Category:** Elasticsearch\
**Created:** [April 11, 2013, 2:54pm UTC](https://discuss.elastic.co/t/string-with-numbers-fails/11552 "2013-04-11T14:54:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hari](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hari/32/1582_2.png) [@hari](https://discuss.elastic.co/u/hari)\
**Post date:** [April 11, 2013, 2:54pm UTC](https://discuss.elastic.co/t/string-with-numbers-fails/11552/1 "2013-04-11T14:54:48Z")

</div>

ES Version: 0.20.6  
Platform: Bodhi Linux, single instance

I'm still learning ES, so excuse me if this is a basic mistake with my  
understanding of how ES works  
I have created an index with name mastercatalog, Refer this gist for the  
details and have loaded a sample set of data

> <https://gist.github.com/hariinfo/5342031>

Following Query works, but if I replace "name" with "partnumber" I don't  
seem to get any results back  
It almost appears that only if my field value is a string (with all  
characters) it seems to return results, but if my string has some numbers  
in it I don't get  
a response back.

Request:  
curl -XPOST '[http://localhost:9200/mastercatalog/\_search?pretty=true](http://localhost:9200/mastercatalog/_search?pretty=true)' -d '{  
"query": {  
"filtered": {  
"query": {  
"bool": {  
"must": [{"term": {"name" :"auchan" }}]  
}  
},  
"filter": {  
"has\_child": {  
"type": "product",  
"query": {  
"filtered": {  
"query": {  
"bool": {  
"must": [{"term": {"name": "toys"}}]  
}  
},  
"filter": {  
"has\_child": {  
"type": "variation",  
"query": {  
"term": {  
"trademark": "tiger"  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}'

Response:

{ "took" : 12, "timed\_out" : false, "\_shards" : { "total" : 5, "successful"  
: 5, "failed" : 0 }, "hits" : { "total" : 1, "max\_score" : 1.4054651,  
"hits" : [ { "\_index" : "mastercatalog", "\_type" : "10101", "\_id" :  
"10101", "\_score" : 1.4054651, "\_source" : { "name" : "auchan", "owner" :  
"chris" } } ] } }

Request that does not work (I replaced{"name": "toys"} with {"partnumber":  
"EI-01G-1"}):

curl -XPOST '[http://localhost:9200/mastercatalog/\_search?pretty=true](http://localhost:9200/mastercatalog/_search?pretty=true)' -d '{  
"query": { "filtered": { "query": { "bool": { "must": [{"term": {"name"  
:"auchan" }}] } }, "filter": { "has\_child": { "type": "product", "query": {  
"filtered": { "query": { "bool": { "must": [{"term": {"partnumber":  
"EI-01G-1"}}] } }, "filter": { "has\_child": { "type": "variation", "query":  
{ "term": { "trademark": "tiger" } } } } } } } } } } }'

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [April 11, 2013, 3:00pm UTC](https://discuss.elastic.co/t/string-with-numbers-fails/11552/2 "2013-04-11T15:00:41Z")

</div>

It's because your field is analyzed (aka break into tokens).  
Change you analyzer for this field to not analyzed for example. Something like:  
$ curl -XPUT '[http://localhost:9200/twitter/tweet/\_mapping](http://localhost:9200/twitter/tweet/_mapping)' -d '  
{  
"tweet" : {  
"properties" : {  
"message" : {"type" : "string", "index" : "not\_analyzed"}  
}  
}  
}  
'

Then, you will be to search for the exact value you sent.

Does it help?

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

Le 11 avr. 2013 à 16:54, Hariharan Vadivelu [hariinfo@gmail.com](mailto:hariinfo@gmail.com) a écrit :

> ES Version: 0.20.6  
> Platform: Bodhi Linux, single instance
> 
> I'm still learning ES, so excuse me if this is a basic mistake with my understanding of how ES works  
> I have created an index with name mastercatalog, Refer this gist for the details and have loaded a sample set of data  
> [elastic\_parent\_child.sh · GitHub](https://gist.github.com/hariinfo/5342031)
> 
> Following Query works, but if I replace "name" with "partnumber" I don't seem to get any results back  
> It almost appears that only if my field value is a string (with all characters) it seems to return results, but if my string has some numbers in it I don't get  
> a response back.
> 
> Request:  
> curl -XPOST '[http://localhost:9200/mastercatalog/\_search?pretty=true](http://localhost:9200/mastercatalog/_search?pretty=true)' -d '{  
> "query": {  
> "filtered": {  
> "query": {  
> "bool": {  
> "must": [{"term": {"name" :"auchan" }}]  
> }  
> },  
> "filter": {  
> "has\_child": {  
> "type": "product",  
> "query": {  
> "filtered": {  
> "query": {  
> "bool": {  
> "must": [{"term": {"name": "toys"}}]  
> }  
> },  
> "filter": {  
> "has\_child": {  
> "type": "variation",  
> "query": {  
> "term": {  
> "trademark": "tiger"  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }'
> 
> Response:
> 
> {  
> "took" : 12,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 1,  
> "max\_score" : 1.4054651,  
> "hits" : [ {  
> "\_index" : "mastercatalog",  
> "\_type" : "10101",  
> "\_id" : "10101",  
> "\_score" : 1.4054651, "\_source" : { "name" : "auchan", "owner" : "chris" }  
> } ]  
> }  
> }
> 
> Request that does not work (I replaced{"name": "toys"} with {"partnumber": "EI-01G-1"}):
> 
> curl -XPOST '[http://localhost:9200/mastercatalog/\_search?pretty=true](http://localhost:9200/mastercatalog/_search?pretty=true)' -d '{  
> "query": {  
> "filtered": {  
> "query": {  
> "bool": {  
> "must": [{"term": {"name" :"auchan" }}]  
> }  
> },  
> "filter": {  
> "has\_child": {  
> "type": "product",  
> "query": {  
> "filtered": {  
> "query": {  
> "bool": {  
> "must": [{"term": {"partnumber": "EI-01G-1"}}]  
> }  
> },  
> "filter": {  
> "has\_child": {  
> "type": "variation",  
> "query": {  
> "term": {  
> "trademark": "tiger"  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }'
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![hari](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hari/32/1582_2.png) [@hari](https://discuss.elastic.co/u/hari)\
**Post date:** [April 11, 2013, 3:17pm UTC](https://discuss.elastic.co/t/string-with-numbers-fails/11552/3 "2013-04-11T15:17:44Z")

</div>

Excellent, That fixed the problem.  
Updated gist [elastic\_parent\_child.sh · GitHub](https://gist.github.com/hariinfo/5342031)

On Thursday, April 11, 2013 9:54:48 AM UTC-5, Hariharan Vadivelu wrote:

> ES Version: 0.20.6  
> Platform: Bodhi Linux, single instance
> 
> I'm still learning ES, so excuse me if this is a basic mistake with my  
> understanding of how ES works  
> I have created an index with name mastercatalog, Refer this gist for the  
> details and have loaded a sample set of data  
> [elastic\_parent\_child.sh · GitHub](https://gist.github.com/hariinfo/5342031)
> 
> Following Query works, but if I replace "name" with "partnumber" I don't  
> seem to get any results back  
> It almost appears that only if my field value is a string (with all  
> characters) it seems to return results, but if my string has some numbers  
> in it I don't get  
> a response back.
> 
> Request:  
> curl -XPOST '[http://localhost:9200/mastercatalog/\_search?pretty=true](http://localhost:9200/mastercatalog/_search?pretty=true)' -d  
> '{  
> "query": {  
> "filtered": {  
> "query": {  
> "bool": {  
> "must": [{"term": {"name" :"auchan" }}]  
> }  
> },  
> "filter": {  
> "has\_child": {  
> "type": "product",  
> "query": {  
> "filtered": {  
> "query": {  
> "bool": {  
> "must": [{"term": {"name": "toys"}}]  
> }  
> },  
> "filter": {  
> "has\_child": {  
> "type": "variation",  
> "query": {  
> "term": {  
> "trademark": "tiger"  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }'
> 
> Response:
> 
> { "took" : 12, "timed\_out" : false, "\_shards" : { "total" : 5,  
> "successful" : 5, "failed" : 0 }, "hits" : { "total" : 1, "max\_score" :  
> 1.4054651, "hits" : [ { "\_index" : "mastercatalog", "\_type" : "10101",  
> "\_id" : "10101", "\_score" : 1.4054651, "\_source" : { "name" : "auchan",  
> "owner" : "chris" } } ] } }
> 
> Request that does not work (I replaced{"name": "toys"} with {"partnumber":  
> "EI-01G-1"}):
> 
> curl -XPOST '[http://localhost:9200/mastercatalog/\_search?pretty=true](http://localhost:9200/mastercatalog/_search?pretty=true)' -d  
> '{ "query": { "filtered": { "query": { "bool": { "must": [{"term": {"name"  
> :"auchan" }}] } }, "filter": { "has\_child": { "type": "product", "query": {  
> "filtered": { "query": { "bool": { "must": [{"term": {"partnumber":  
> "EI-01G-1"}}] } }, "filter": { "has\_child": { "type": "variation", "query":  
> { "term": { "trademark": "tiger" } } } } } } } } } } }'

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:41am UTC](https://discuss.elastic.co/t/string-with-numbers-fails/11552/4 "2017-07-06T02:41:32Z")

</div>


