# Error while requesting elasticsearch with a numerical range on a field which doesn't exist

**URL:** <https://discuss.elastic.co/t/error-while-requesting-elasticsearch-with-a-numerical-range-on-a-field-which-doesnt-exist/9383>\
**Category:** Elasticsearch\
**Created:** [October 16, 2012, 4:01pm UTC](https://discuss.elastic.co/t/error-while-requesting-elasticsearch-with-a-numerical-range-on-a-field-which-doesnt-exist/9383 "2012-10-16T16:01:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick\_Logan](https://avatars.discourse-cdn.com/v4/letter/p/fbc32d/32.png) [@Patrick\_Logan](https://discuss.elastic.co/u/Patrick_Logan)\
**Post date:** [October 16, 2012, 4:01pm UTC](https://discuss.elastic.co/t/error-while-requesting-elasticsearch-with-a-numerical-range-on-a-field-which-doesnt-exist/9383/1 "2012-10-16T16:01:00Z")

</div>

Hello,

I have an error while requesting elasticsearch with a numerical range on a  
field which doesn't exist. I expected no error and an empty result, but i  
got an error. Is this the expected behaviour ?

Some information about my elasticsearch :  
version : 0.19.7  
mapping :

$ curl -XGET '[http://localhost:9200/\_mapping](http://localhost:9200/_mapping)'

returns : {"twitter":{"user":{"properties":{"name":{"type":"string"}}}}}

This works :  
$ curl -X DELETE localhost:9200  
$ curl -XPUT [http://localhost:9200/twitter/user/kimchy](http://localhost:9200/twitter/user/kimchy) -d '{  
"name" : "Shay Banon"  
}'  
$ curl -XPOST '[http://localhost:9200/\_search](http://localhost:9200/_search)' -d '{  
"from": 0,  
"size": 50,  
"query": {  
"constant\_score": {  
"filter": {  
"query": {  
"query\_string": {  
"default\_field": "Date",  
"query": "something"  
}  
}  
}  
}  
}  
}'

it returns  
: {"took":19,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":[]}}

But this does not work :

$ curl -X DELETE localhost:9200  
$ curl -XPUT [http://localhost:9200/twitter/user/kimchy](http://localhost:9200/twitter/user/kimchy) -d '{  
"name" : "Shay Banon"  
}'  
$ curl -XPOST '[http://localhost:9200/\_search](http://localhost:9200/_search)' -d '{  
"from": 0,  
"size": 50,  
"query": {  
"constant\_score": {  
"filter": {  
"numeric\_range": {  
"Date": {  
"gte": "1",  
"lte": "2"  
}  
}  
}  
}  
}  
}'

it returns : {"error":"SearchPhaseExecutionException[Failed to execute  
phase [query], total failure; shardFailures  
{[re38KT1uRm6j1ux0lKzmiQ][twitter][3]: SearchParseException[[twitter][3]:  
from[0],size[50]: Parse Failure [Failed to parse source [{\n "from":  
0,\n "size": 50,\n "query": {\n "constant\_score": {\n  
"filter": {\n "numeric\_range": {\n "Date": {\n  
"gte": "1",\n "lte": "2"\n }\n }\n  
}\n }\n }\n}]]]; nested: QueryParsingException[[twitter] failed to  
find mapping for field [Date]]; }{[re38KT1uRm6j1ux0lKzmiQ][twitter][2]:  
SearchParseException[[twitter][2]: from[0],size[50]: Parse Failure [Failed  
to parse source [{\n "from": 0,\n "size": 50,\n "query": {\n  
"constant\_score": {\n "filter": {\n "numeric\_range": {\n  
"Date": {\n "gte": "1",\n "lte":  
"2"\n }\n }\n }\n }\n }\n}]]]; nested:  
QueryParsingException[[twitter] failed to find mapping for field [Date]];  
}{[re38KT1uRm6j1ux0lKzmiQ][twitter][1]: SearchParseException[[twitter][1]:  
from[0],size[50]: Parse Failure [Failed to parse source [{\n "from":  
0,\n "size": 50,\n "query": {\n "constant\_score": {\n  
"filter": {\n "numeric\_range": {\n "Date": {\n  
"gte": "1",\n "lte": "2"\n }\n }\n  
}\n }\n }\n}]]]; nested: QueryParsingException[[twitter] failed to  
find mapping for field [Date]]; }{[re38KT1uRm6j1ux0lKzmiQ][twitter][0]:  
SearchParseException[[twitter][0]: from[0],size[50]: Parse Failure [Failed  
to parse source [{\n "from": 0,\n "size": 50,\n "query": {\n  
"constant\_score": {\n "filter": {\n "numeric\_range": {\n  
"Date": {\n "gte": "1",\n "lte":  
"2"\n }\n }\n }\n }\n }\n}]]]; nested:  
QueryParsingException[[twitter] failed to find mapping for field [Date]];  
}{[re38KT1uRm6j1ux0lKzmiQ][twitter][4]: SearchParseException[[twitter][4]:  
from[0],size[50]: Parse Failure [Failed to parse source [{\n "from":  
0,\n "size": 50,\n "query": {\n "constant\_score": {\n  
"filter": {\n "numeric\_range": {\n "Date": {\n  
"gte": "1",\n "lte": "2"\n }\n }\n  
}\n }\n }\n}]]]; nested: QueryParsingException[[twitter] failed to  
find mapping for field [Date]]; }]","status":500}

Do you have the same error ? Is this a normal/expected behaviour ? What do  
you think could be done to solve this problem ?

Thank you.  
Patrick

--

---

<div class="post-metadata">

**Author:** ![zkidkid](https://avatars.discourse-cdn.com/v4/letter/z/fbc32d/32.png) [@zkidkid](https://discuss.elastic.co/u/zkidkid)\
**Post date:** [October 17, 2012, 3:56am UTC](https://discuss.elastic.co/t/error-while-requesting-elasticsearch-with-a-numerical-range-on-a-field-which-doesnt-exist/9383/2 "2012-10-17T03:56:55Z")

</div>

Yes, it's normal.  
You would need this log.

In some other request, you need to sure that your index have a specify  
field, (eg: sort).

On Tuesday, October 16, 2012 11:01:00 PM UTC+7, Patrick Logan wrote:

> Hello,
> 
> I have an error while requesting elasticsearch with a numerical range on a  
> field which doesn't exist. I expected no error and an empty result, but i  
> got an error. Is this the expected behaviour ?
> 
> Some information about my elasticsearch :  
> version : 0.19.7  
> mapping :
> 
> $ curl -XGET '[http://localhost:9200/\_mapping](http://localhost:9200/_mapping)'
> 
> returns : {"twitter":{"user":{"properties":{"name":{"type":"string"}}}}}
> 
> This works :  
> $ curl -X DELETE localhost:9200  
> $ curl -XPUT [http://localhost:9200/twitter/user/kimchy](http://localhost:9200/twitter/user/kimchy) -d '{  
> "name" : "Shay Banon"  
> }'  
> $ curl -XPOST '[http://localhost:9200/\_search](http://localhost:9200/_search)' -d '{  
> "from": 0,  
> "size": 50,  
> "query": {  
> "constant\_score": {  
> "filter": {  
> "query": {  
> "query\_string": {  
> "default\_field": "Date",  
> "query": "something"  
> }  
> }  
> }  
> }  
> }  
> }'
> 
> it returns  
> : {"took":19,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":}}
> 
> But this does not work :
> 
> $ curl -X DELETE localhost:9200  
> $ curl -XPUT [http://localhost:9200/twitter/user/kimchy](http://localhost:9200/twitter/user/kimchy) -d '{  
> "name" : "Shay Banon"  
> }'  
> $ curl -XPOST '[http://localhost:9200/\_search](http://localhost:9200/_search)' -d '{  
> "from": 0,  
> "size": 50,  
> "query": {  
> "constant\_score": {  
> "filter": {  
> "numeric\_range": {  
> "Date": {  
> "gte": "1",  
> "lte": "2"  
> }  
> }  
> }  
> }  
> }  
> }'
> 
> it returns : {"error":"SearchPhaseExecutionException[Failed to execute  
> phase [query], total failure; shardFailures  
> {[re38KT1uRm6j1ux0lKzmiQ][twitter][3]: SearchParseException[[twitter][3]:  
> from[0],size[50]: Parse Failure [Failed to parse source [{\n "from":  
> 0,\n "size": 50,\n "query": {\n "constant\_score": {\n  
> "filter": {\n "numeric\_range": {\n "Date": {\n  
> "gte": "1",\n "lte": "2"\n }\n }\n  
> }\n }\n }\n}]]]; nested: QueryParsingException[[twitter] failed to  
> find mapping for field [Date]]; }{[re38KT1uRm6j1ux0lKzmiQ][twitter][2]:  
> SearchParseException[[twitter][2]: from[0],size[50]: Parse Failure [Failed  
> to parse source [{\n "from": 0,\n "size": 50,\n "query": {\n  
> "constant\_score": {\n "filter": {\n "numeric\_range": {\n  
> "Date": {\n "gte": "1",\n "lte":  
> "2"\n }\n }\n }\n }\n }\n}]]]; nested:  
> QueryParsingException[[twitter] failed to find mapping for field [Date]];  
> }{[re38KT1uRm6j1ux0lKzmiQ][twitter][1]: SearchParseException[[twitter][1]:  
> from[0],size[50]: Parse Failure [Failed to parse source [{\n "from":  
> 0,\n "size": 50,\n "query": {\n "constant\_score": {\n  
> "filter": {\n "numeric\_range": {\n "Date": {\n  
> "gte": "1",\n "lte": "2"\n }\n }\n  
> }\n }\n }\n}]]]; nested: QueryParsingException[[twitter] failed to  
> find mapping for field [Date]]; }{[re38KT1uRm6j1ux0lKzmiQ][twitter][0]:  
> SearchParseException[[twitter][0]: from[0],size[50]: Parse Failure [Failed  
> to parse source [{\n "from": 0,\n "size": 50,\n "query": {\n  
> "constant\_score": {\n "filter": {\n "numeric\_range": {\n  
> "Date": {\n "gte": "1",\n "lte":  
> "2"\n }\n }\n }\n }\n }\n}]]]; nested:  
> QueryParsingException[[twitter] failed to find mapping for field [Date]];  
> }{[re38KT1uRm6j1ux0lKzmiQ][twitter][4]: SearchParseException[[twitter][4]:  
> from[0],size[50]: Parse Failure [Failed to parse source [{\n "from":  
> 0,\n "size": 50,\n "query": {\n "constant\_score": {\n  
> "filter": {\n "numeric\_range": {\n "Date": {\n  
> "gte": "1",\n "lte": "2"\n }\n }\n  
> }\n }\n }\n}]]]; nested: QueryParsingException[[twitter] failed to  
> find mapping for field [Date]]; }]","status":500}
> 
> Do you have the same error ? Is this a normal/expected behaviour ? What do  
> you think could be done to solve this problem ?
> 
> Thank you.  
> Patrick

--

---

<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, 3:08am UTC](https://discuss.elastic.co/t/error-while-requesting-elasticsearch-with-a-numerical-range-on-a-field-which-doesnt-exist/9383/3 "2017-07-06T03:08:23Z")

</div>


