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

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[
…… 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.


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
To view this discussion on the web visit
For more options, visit