# QueryParsingException exception thrown only for empty index

**URL:** <https://discuss.elastic.co/t/queryparsingexception-exception-thrown-only-for-empty-index/8402>\
**Category:** Elasticsearch\
**Created:** [July 12, 2012, 11:53pm UTC](https://discuss.elastic.co/t/queryparsingexception-exception-thrown-only-for-empty-index/8402 "2012-07-12T23:53:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashish\_Nigam\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashish_nigam_2/32/2804_2.png) [@Ashish\_Nigam\_2](https://discuss.elastic.co/u/Ashish_Nigam_2)\
**Post date:** [July 12, 2012, 11:53pm UTC](https://discuss.elastic.co/t/queryparsingexception-exception-thrown-only-for-empty-index/8402/1 "2012-07-12T23:53:22Z")

</div>

Hi,  
I notice this exception only when index is empty, i.e. there is no data for an index. Query is embedded in the exception stack trace.

16:42:19.148 [elasticsearch[local\_jvm\_node][search][T#1]] DEBUG org.elasticsearch.action.count - [local\_jvm\_node] [testindex\_10][4], node[1], [P], s[STARTED]: Failed to execute [[[testalias\_10]][], querySource[{"constant\_score":{"filter":{"and":{"filters":[{"term":{"tenantId":"10"}},{"numeric\_range":{"fromTime":{"from":1342072320000,"to":null,"include\_lower":true,"include\_upper":true}}},{"numeric\_range":{"toTime":{"from":null,"to":1342072320000,"include\_lower":true,"include\_upper":true}}},{"terms":{"cspId":[]}}]}}}}]]  
org.elasticsearch.index.query.QueryParsingException: [testindex\_10] failed to find mapping for field [fromTime]  
at org.elasticsearch.index.query.NumericRangeFilterParser.parse(NumericRangeFilterParser.java:115) ~[elasticsearch-0.19.6.jar:na]  
at org.elasticsearch.index.query.QueryParseContext.parseInnerFilter(QueryParseContext.java:223) ~[elasticsearch-0.19.6.jar:na]  
at org.elasticsearch.index.query.AndFilterParser.parse(AndFilterParser.java:72) ~[elasticsearch-0.19.6.jar:na]  
at org.elasticsearch.index.query.QueryParseContext.parseInnerFilter(QueryParseContext.java:223) ~[elasticsearch-0.19.6.jar:na]  
at org.elasticsearch.index.query.ConstantScoreQueryParser.parse(ConstantScoreQueryParser.java:66) ~[elasticsearch-0.19.6.jar:na]  
at org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:187) ~[elasticsearch-0.19.6.jar:na]  
at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:249) ~[elasticsearch-0.19.6.jar:na]  
at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:199) ~[elasticsearch-0.19.6.jar:na]  
at org.elasticsearch.index.shard.service.InternalIndexShard.count(InternalIndexShard.java:409) ~[elasticsearch-0.19.6.jar:na]  
at org.elasticsearch.action.count.TransportCountAction.shardOperation(TransportCountAction.java:134) ~[elasticsearch-0.19.6.jar:na]  
at org.elasticsearch.action.count.TransportCountAction.shardOperation(TransportCountAction.java:50) ~[elasticsearch-0.19.6.jar:na]  
at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.performOperation(TransportBroadcastOperationAction.java:234) [elasticsearch-0.19.6.jar:na]  
at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.performOperation(TransportBroadcastOperationAction.java:211) [elasticsearch-0.19.6.jar:na]  
at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction$1.run(TransportBroadcastOperationAction.java:187) [elasticsearch-0.19.6.jar:na]  
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0\_33]  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0\_33]  
at java.lang.Thread.run(Thread.java:680) [na:1.6.0\_33]

Any idea why this would happen? As soon as I put some data in index, and run the same query, I do not see this exception.  
In index mapping, "fromTime" is mapped to "date".

Thanks  
Ashish

---

<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:** [July 13, 2012, 12:20am UTC](https://discuss.elastic.co/t/queryparsingexception-exception-thrown-only-for-empty-index/8402/2 "2012-07-13T00:20:03Z")

</div>

Did you create the index ?  
Or is the index created when you put your first document ?

If you created the index, did you set the mapping ?

David

--

Le 13 juil. 2012 à 01:53, Ashish Nigam [nigamashish@gmail.com](mailto:nigamashish@gmail.com) a écrit :

> Hi,  
> I notice this exception only when index is empty, i.e. there is no data for an index. Query is embedded in the exception stack trace.
> 
> 16:42:19.148 [elasticsearch[local\_jvm\_node][search][T#1]] DEBUG org.elasticsearch.action.count - [local\_jvm\_node] [testindex\_10][4], node[1], [P], s[STARTED]: Failed to execute [[[testalias\_10]], querySource[{"constant\_score":{"filter":{"and":{"filters":[{"term":{"tenantId":"10"}},{"numeric\_range":{"fromTime":{"from":1342072320000,"to":null,"include\_lower":true,"include\_upper":true}}},{"numeric\_range":{"toTime":{"from":null,"to":1342072320000,"include\_lower":true,"include\_upper":true}}},{"terms":{"cspId":}}]}}}}]]  
> org.elasticsearch.index.query.QueryParsingException: [testindex\_10] failed to find mapping for field [fromTime]  
> at org.elasticsearch.index.query.NumericRangeFilterParser.parse(NumericRangeFilterParser.java:115) ~[elasticsearch-0.19.6.jar:na]  
> at org.elasticsearch.index.query.QueryParseContext.parseInnerFilter(QueryParseContext.java:223) ~[elasticsearch-0.19.6.jar:na]  
> at org.elasticsearch.index.query.AndFilterParser.parse(AndFilterParser.java:72) ~[elasticsearch-0.19.6.jar:na]  
> at org.elasticsearch.index.query.QueryParseContext.parseInnerFilter(QueryParseContext.java:223) ~[elasticsearch-0.19.6.jar:na]  
> at org.elasticsearch.index.query.ConstantScoreQueryParser.parse(ConstantScoreQueryParser.java:66) ~[elasticsearch-0.19.6.jar:na]  
> at org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:187) ~[elasticsearch-0.19.6.jar:na]  
> at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:249) ~[elasticsearch-0.19.6.jar:na]  
> at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:199) ~[elasticsearch-0.19.6.jar:na]  
> at org.elasticsearch.index.shard.service.InternalIndexShard.count(InternalIndexShard.java:409) ~[elasticsearch-0.19.6.jar:na]  
> at org.elasticsearch.action.count.TransportCountAction.shardOperation(TransportCountAction.java:134) ~[elasticsearch-0.19.6.jar:na]  
> at org.elasticsearch.action.count.TransportCountAction.shardOperation(TransportCountAction.java:50) ~[elasticsearch-0.19.6.jar:na]  
> at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.performOperation(TransportBroadcastOperationAction.java:234) [elasticsearch-0.19.6.jar:na]  
> at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.performOperation(TransportBroadcastOperationAction.java:211) [elasticsearch-0.19.6.jar:na]  
> at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction$1.run(TransportBroadcastOperationAction.java:187) [elasticsearch-0.19.6.jar:na]  
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0\_33]  
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0\_33]  
> at java.lang.Thread.run(Thread.java:680) [na:1.6.0\_33]
> 
> Any idea why this would happen? As soon as I put some data in index, and run the same query, I do not see this exception.  
> In index mapping, "fromTime" is mapped to "date".
> 
> Thanks  
> Ashish

---

<div class="post-metadata">

**Author:** ![Ashish\_Nigam\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashish_nigam_2/32/2804_2.png) [@Ashish\_Nigam\_2](https://discuss.elastic.co/u/Ashish_Nigam_2)\
**Post date:** [July 13, 2012, 1:23am UTC](https://discuss.elastic.co/t/queryparsingexception-exception-thrown-only-for-empty-index/8402/3 "2012-07-13T01:23:34Z")

</div>

Yes, Index is already created and I also set the mapping. Here's index mapping -

{  
state: open  
settings: {  
index.analysis.analyzer.comma.type: pattern  
index.analysis.analyzer.comma.pattern: (^\s+)|(\s\*),(\s\*)|(\s+$)  
index.number\_of\_shards: 5  
index.number\_of\_replicas: 1  
index.version.created: 190399  
}  
mappings: {  
eventsummarydata: {  
\_source: {  
compress: true  
}  
dynamic\_templates: [  
{  
store\_generic: {  
mapping: {  
index: not\_analyzed  
}  
match: \*  
}  
}  
]  
properties: {  
tenantId: {  
type: integer  
}  
count: {  
type: integer  
}  
uniqueUsers: {  
analyzer: comma  
type: string  
}  
userIdentifier: {  
type: integer  
}  
locationId: {  
type: integer  
}  
uniqueUsersCount: {  
type: integer  
}  
cspId: {  
type: integer  
}  
id: {  
type: integer  
}  
totime: {  
format: dateOptionalTime  
type: date  
}  
uploadId: {  
type: integer  
}  
fromtime: {  
format: dateOptionalTime  
type: date  
}  
group2: {  
analyzer: comma  
type: string  
}  
deviceId: {  
type: integer  
}  
}  
}  
}  
aliases: [  
testalias\_10  
]  
}

Thanks  
Ashish

On Jul 12, 2012, at 5:20 PM, David Pilato wrote:

> Did you create the index ?  
> Or is the index created when you put your first document ?
> 
> If you created the index, did you set the mapping ?
> 
> David
> 
> --
> 
> Le 13 juil. 2012 à 01:53, Ashish Nigam [nigamashish@gmail.com](mailto:nigamashish@gmail.com) a écrit :
> 
> > Hi,  
> > I notice this exception only when index is empty, i.e. there is no data for an index. Query is embedded in the exception stack trace.
> > 
> > 16:42:19.148 [elasticsearch[local\_jvm\_node][search][T#1]] DEBUG org.elasticsearch.action.count - [local\_jvm\_node] [testindex\_10][4], node[1], [P], s[STARTED]: Failed to execute [[[testalias\_10]], querySource[{"constant\_score":{"filter":{"and":{"filters":[{"term":{"tenantId":"10"}},{"numeric\_range":{"fromTime":{"from":1342072320000,"to":null,"include\_lower":true,"include\_upper":true}}},{"numeric\_range":{"toTime":{"from":null,"to":1342072320000,"include\_lower":true,"include\_upper":true}}},{"terms":{"cspId":}}]}}}}]]  
> > org.elasticsearch.index.query.QueryParsingException: [testindex\_10] failed to find mapping for field [fromTime]  
> > at org.elasticsearch.index.query.NumericRangeFilterParser.parse(NumericRangeFilterParser.java:115) ~[elasticsearch-0.19.6.jar:na]  
> > at org.elasticsearch.index.query.QueryParseContext.parseInnerFilter(QueryParseContext.java:223) ~[elasticsearch-0.19.6.jar:na]  
> > at org.elasticsearch.index.query.AndFilterParser.parse(AndFilterParser.java:72) ~[elasticsearch-0.19.6.jar:na]  
> > at org.elasticsearch.index.query.QueryParseContext.parseInnerFilter(QueryParseContext.java:223) ~[elasticsearch-0.19.6.jar:na]  
> > at org.elasticsearch.index.query.ConstantScoreQueryParser.parse(ConstantScoreQueryParser.java:66) ~[elasticsearch-0.19.6.jar:na]  
> > at org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:187) ~[elasticsearch-0.19.6.jar:na]  
> > at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:249) ~[elasticsearch-0.19.6.jar:na]  
> > at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:199) ~[elasticsearch-0.19.6.jar:na]  
> > at org.elasticsearch.index.shard.service.InternalIndexShard.count(InternalIndexShard.java:409) ~[elasticsearch-0.19.6.jar:na]  
> > at org.elasticsearch.action.count.TransportCountAction.shardOperation(TransportCountAction.java:134) ~[elasticsearch-0.19.6.jar:na]  
> > at org.elasticsearch.action.count.TransportCountAction.shardOperation(TransportCountAction.java:50) ~[elasticsearch-0.19.6.jar:na]  
> > at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.performOperation(TransportBroadcastOperationAction.java:234) [elasticsearch-0.19.6.jar:na]  
> > at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.performOperation(TransportBroadcastOperationAction.java:211) [elasticsearch-0.19.6.jar:na]  
> > at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction$1.run(TransportBroadcastOperationAction.java:187) [elasticsearch-0.19.6.jar:na]  
> > at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0\_33]  
> > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0\_33]  
> > at java.lang.Thread.run(Thread.java:680) [na:1.6.0\_33]
> > 
> > Any idea why this would happen? As soon as I put some data in index, and run the same query, I do not see this exception.  
> > In index mapping, "fromTime" is mapped to "date".
> > 
> > Thanks  
> > Ashish

---

<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:** [July 13, 2012, 6:45am UTC](https://discuss.elastic.co/t/queryparsingexception-exception-thrown-only-for-empty-index/8402/4 "2012-07-13T06:45:43Z")

</div>

In your mapping you have fromtime but you ask for fromTime.  
It could be your problem.

David

--

Le 13 juil. 2012 à 03:23, Ashish Nigam [nigamashish@gmail.com](mailto:nigamashish@gmail.com) a écrit :

> Yes, Index is already created and I also set the mapping. Here's index mapping -
> 
> {  
> state: open  
> settings: {  
> index.analysis.analyzer.comma.type: pattern  
> index.analysis.analyzer.comma.pattern: (^\s+)|(\s\*),(\s\*)|(\s+$)  
> index.number\_of\_shards: 5  
> index.number\_of\_replicas: 1  
> index.version.created: 190399  
> }  
> mappings: {  
> eventsummarydata: {  
> \_source: {  
> compress: true  
> }  
> dynamic\_templates: [  
> {  
> store\_generic: {  
> mapping: {  
> index: not\_analyzed  
> }  
> match: \*  
> }  
> }  
> ]  
> properties: {  
> tenantId: {  
> type: integer  
> }  
> count: {  
> type: integer  
> }  
> uniqueUsers: {  
> analyzer: comma  
> type: string  
> }  
> userIdentifier: {  
> type: integer  
> }  
> locationId: {  
> type: integer  
> }  
> uniqueUsersCount: {  
> type: integer  
> }  
> cspId: {  
> type: integer  
> }  
> id: {  
> type: integer  
> }  
> totime: {  
> format: dateOptionalTime  
> type: date  
> }  
> uploadId: {  
> type: integer  
> }  
> fromtime: {  
> format: dateOptionalTime  
> type: date  
> }  
> group2: {  
> analyzer: comma  
> type: string  
> }  
> deviceId: {  
> type: integer  
> }  
> }  
> }  
> }  
> aliases: [  
> testalias\_10  
> ]  
> }
> 
> Thanks  
> Ashish
> 
> On Jul 12, 2012, at 5:20 PM, David Pilato wrote:
> 
> > Did you create the index ?  
> > Or is the index created when you put your first document ?
> > 
> > If you created the index, did you set the mapping ?
> > 
> > David
> > 
> > --
> > 
> > Le 13 juil. 2012 à 01:53, Ashish Nigam [nigamashish@gmail.com](mailto:nigamashish@gmail.com) a écrit :
> > 
> > > Hi,  
> > > I notice this exception only when index is empty, i.e. there is no data for an index. Query is embedded in the exception stack trace.
> > > 
> > > 16:42:19.148 [elasticsearch[local\_jvm\_node][search][T#1]] DEBUG org.elasticsearch.action.count - [local\_jvm\_node] [testindex\_10][4], node[1], [P], s[STARTED]: Failed to execute [[[testalias\_10]], querySource[{"constant\_score":{"filter":{"and":{"filters":[{"term":{"tenantId":"10"}},{"numeric\_range":{"fromTime":{"from":1342072320000,"to":null,"include\_lower":true,"include\_upper":true}}},{"numeric\_range":{"toTime":{"from":null,"to":1342072320000,"include\_lower":true,"include\_upper":true}}},{"terms":{"cspId":}}]}}}}]]  
> > > org.elasticsearch.index.query.QueryParsingException: [testindex\_10] failed to find mapping for field [fromTime]  
> > > at org.elasticsearch.index.query.NumericRangeFilterParser.parse(NumericRangeFilterParser.java:115) ~[elasticsearch-0.19.6.jar:na]  
> > > at org.elasticsearch.index.query.QueryParseContext.parseInnerFilter(QueryParseContext.java:223) ~[elasticsearch-0.19.6.jar:na]  
> > > at org.elasticsearch.index.query.AndFilterParser.parse(AndFilterParser.java:72) ~[elasticsearch-0.19.6.jar:na]  
> > > at org.elasticsearch.index.query.QueryParseContext.parseInnerFilter(QueryParseContext.java:223) ~[elasticsearch-0.19.6.jar:na]  
> > > at org.elasticsearch.index.query.ConstantScoreQueryParser.parse(ConstantScoreQueryParser.java:66) ~[elasticsearch-0.19.6.jar:na]  
> > > at org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:187) ~[elasticsearch-0.19.6.jar:na]  
> > > at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:249) ~[elasticsearch-0.19.6.jar:na]  
> > > at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:199) ~[elasticsearch-0.19.6.jar:na]  
> > > at org.elasticsearch.index.shard.service.InternalIndexShard.count(InternalIndexShard.java:409) ~[elasticsearch-0.19.6.jar:na]  
> > > at org.elasticsearch.action.count.TransportCountAction.shardOperation(TransportCountAction.java:134) ~[elasticsearch-0.19.6.jar:na]  
> > > at org.elasticsearch.action.count.TransportCountAction.shardOperation(TransportCountAction.java:50) ~[elasticsearch-0.19.6.jar:na]  
> > > at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.performOperation(TransportBroadcastOperationAction.java:234) [elasticsearch-0.19.6.jar:na]  
> > > at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.performOperation(TransportBroadcastOperationAction.java:211) [elasticsearch-0.19.6.jar:na]  
> > > at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction$1.run(TransportBroadcastOperationAction.java:187) [elasticsearch-0.19.6.jar:na]  
> > > at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0\_33]  
> > > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0\_33]  
> > > at java.lang.Thread.run(Thread.java:680) [na:1.6.0\_33]
> > > 
> > > Any idea why this would happen? As soon as I put some data in index, and run the same query, I do not see this exception.  
> > > In index mapping, "fromTime" is mapped to "date".
> > > 
> > > Thanks  
> > > Ashish

---

<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:20am UTC](https://discuss.elastic.co/t/queryparsingexception-exception-thrown-only-for-empty-index/8402/5 "2017-07-06T03:20:24Z")

</div>


