# SearchParseException if run query with sorting on not yet created type of document

**URL:** <https://discuss.elastic.co/t/searchparseexception-if-run-query-with-sorting-on-not-yet-created-type-of-document/16080>\
**Category:** Elasticsearch\
**Created:** [February 28, 2014, 10:34pm UTC](https://discuss.elastic.co/t/searchparseexception-if-run-query-with-sorting-on-not-yet-created-type-of-document/16080 "2014-02-28T22:34:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugene\_Strokin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_strokin/32/1238_2.png) [@Eugene\_Strokin](https://discuss.elastic.co/u/Eugene_Strokin)\
**Post date:** [February 28, 2014, 10:34pm UTC](https://discuss.elastic.co/t/searchparseexception-if-run-query-with-sorting-on-not-yet-created-type-of-document/16080/1 "2014-02-28T22:34:38Z")

</div>

Hello,  
I need to run queries periodically. But because my mappings created  
dynamically it is possible that I could run query against document type  
which is not yet created. And if my query need to sort on some field I'm  
getting SearchParseException:

Failed to execute phase [query], all shards failed; shardFailures {[bNA\_-  
MVqQ-6aBKZ\_iki0hQ][ccio][3]: SearchParseException[[ccio][3]: query[  
ConstantScore(cache(NotFilter(cache(BooleanFilter(  
…… snip …..  
Parse Failure [No mapping found for [userId] in order to sort on]

It is a valid message, but should ES throw the error, instead of returning  
empty result, as it would return on any other query against not existed  
type? I expected empty result of course.

Thanks,  
Eugene

--  
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/3e29d7fb-f5b3-4405-bc3a-dbd7b7fdaa8d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3e29d7fb-f5b3-4405-bc3a-dbd7b7fdaa8d%40googlegroups.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, 1:46am UTC](https://discuss.elastic.co/t/searchparseexception-if-run-query-with-sorting-on-not-yet-created-type-of-document/16080/2 "2017-07-06T01:46:25Z")

</div>


