# Bug with issue 1558 - "Allow search to continue when sort field is missing from type mapping"

**URL:** <https://discuss.elastic.co/t/bug-with-issue-1558-allow-search-to-continue-when-sort-field-is-missing-from-type-mapping/6257>\
**Category:** Elasticsearch\
**Created:** [December 30, 2011, 3:24am UTC](https://discuss.elastic.co/t/bug-with-issue-1558-allow-search-to-continue-when-sort-field-is-missing-from-type-mapping/6257 "2011-12-30T03:24:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryan\_Green](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bryan_green/32/3028_2.png) [@Bryan\_Green](https://discuss.elastic.co/u/Bryan_Green)\
**Post date:** [December 30, 2011, 3:24am UTC](https://discuss.elastic.co/t/bug-with-issue-1558-allow-search-to-continue-when-sort-field-is-missing-from-type-mapping/6257/1 "2011-12-30T03:24:41Z")

</div>

Fails with ReduceSearchPhaseException[Failed to execute phase [fetch],  
[reduce] ]; nested:

url: kk,system,library/statustype/\_search  
query: {"from":0,"size":999,"sort":{"order\_no":  
{"order":"asc","ignore\_unmapped":true}}}

The "statustype" item type only exists in the system and library  
indexes but not in the kk index.

The query executes against the kk index and either the system or  
library index BUT when all three are together the search fails.

The title field is defined in the statustype item mapping and exists  
in all instances.

Removing the sort of the query dsl causes the search to success.

If I remove the "ignore\_unmapped" part of the sort then I receive  
errors from the kk index but the search hits still come back for the  
other indexes...

Preferably, the "ignore\_unmapped" feature should allow all data to be  
returned but provide a cascaded sort feature whereby ignoring certain  
sort keys but still continuing with the next sort field (if  
available.)

What else can I provide?

Thanks,  
Bryan

> <https://github.com/elastic/elasticsearch/issues/1558>

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [December 30, 2011, 11:24am UTC](https://discuss.elastic.co/t/bug-with-issue-1558-allow-search-to-continue-when-sort-field-is-missing-from-type-mapping/6257/2 "2011-12-30T11:24:25Z")

</div>

I see, the feature was added assuming the field is missing on all shards,  
not on some of them. Open a different issue for that one, its trickier  
though.

On Fri, Dec 30, 2011 at 5:24 AM, Bryan Green [bryogreen@gmail.com](mailto:bryogreen@gmail.com) wrote:

> Fails with ReduceSearchPhaseException[Failed to execute phase [fetch],  
> [reduce] ]; nested:
> 
> url: kk,system,library/statustype/\_search  
> query: {"from":0,"size":999,"sort":{"order\_no":  
> {"order":"asc","ignore\_unmapped":true}}}
> 
> The "statustype" item type only exists in the system and library  
> indexes but not in the kk index.
> 
> The query executes against the kk index and either the system or  
> library index BUT when all three are together the search fails.
> 
> The title field is defined in the statustype item mapping and exists  
> in all instances.
> 
> Removing the sort of the query dsl causes the search to success.
> 
> If I remove the "ignore\_unmapped" part of the sort then I receive  
> errors from the kk index but the search hits still come back for the  
> other indexes...
> 
> Preferably, the "ignore\_unmapped" feature should allow all data to be  
> returned but provide a cascaded sort feature whereby ignoring certain  
> sort keys but still continuing with the next sort field (if  
> available.)
> 
> What else can I provide?
> 
> Thanks,  
> Bryan
> 
> [Allow search to continue when sort field is missing from type mapping · Issue #1558 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1558)

---

<div class="post-metadata">

**Author:** ![Bryan\_Green](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bryan_green/32/3028_2.png) [@Bryan\_Green](https://discuss.elastic.co/u/Bryan_Green)\
**Post date:** [December 30, 2011, 5:13pm UTC](https://discuss.elastic.co/t/bug-with-issue-1558-allow-search-to-continue-when-sort-field-is-missing-from-type-mapping/6257/3 "2011-12-30T17:13:14Z")

</div>

Done...

> <https://github.com/elastic/elasticsearch/issues/1578>
>
> The 'ignore\_unmapped' feature needs to poll the mapping on each shard rather tha…n going with an all/nothing assumption for the field.
> 
> In reference to: https://groups.google.com/group/elasticsearch/browse\_thread/thread/4b677ad9e88b1967
> Related to issue 1558: https://github.com/elasticsearch/elasticsearch/issues/1558
> 
> Initial setup:
> Fails with ReduceSearchPhaseException\[Failed to execute phase \[fetch\], \[reduce\] \]; nested: 
> url: kk,system,library/statustype/\_search 
> query: {"from":0,"size":999,"sort":{"order\_no": {"order":"asc","ignore\_unmapped":true}}} 
> The "statustype" item type only exists in the system and library indexes but not in the kk index. 
> The query executes against the kk index and either the system or library index BUT when all three are together the search fails. 
> The title field is defined in the statustype item mapping and exists in all instances. 
> Removing the sort of the query dsl causes the search to succeed. 
> If I remove the "ignore\_unmapped" part of the sort then I receive errors from the kk index but the search hits still come back for the other indexes... 
> Preferably, the "ignore\_unmapped" feature should allow all data to be returned but provide a cascaded sort feature whereby ignoring certain sort keys but still continuing with the next sort field (if available.)

Thank you.

On Dec 30, 5:24 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> I see, the feature was added assuming the field is missing on all shards,  
> not on some of them. Open a different issue for that one, its trickier  
> though.
> 
> On Fri, Dec 30, 2011 at 5:24 AM, Bryan Green [bryogr...@gmail.com](mailto:bryogr...@gmail.com) wrote:
> 
> > Fails with ReduceSearchPhaseException[Failed to execute phase [fetch],  
> > [reduce] ]; nested:
> 
> > url: kk,system,library/statustype/\_search  
> > query: {"from":0,"size":999,"sort":{"order\_no":  
> > {"order":"asc","ignore\_unmapped":true}}}
> 
> > The "statustype" item type only exists in the system and library  
> > indexes but not in the kk index.
> 
> > The query executes against the kk index and either the system or  
> > library index BUT when all three are together the search fails.
> 
> > The title field is defined in the statustype item mapping and exists  
> > in all instances.
> 
> > Removing the sort of the query dsl causes the search to success.
> 
> > If I remove the "ignore\_unmapped" part of the sort then I receive  
> > errors from the kk index but the search hits still come back for the  
> > other indexes...
> 
> > Preferably, the "ignore\_unmapped" feature should allow all data to be  
> > returned but provide a cascaded sort feature whereby ignoring certain  
> > sort keys but still continuing with the next sort field (if  
> > available.)
> 
> > What else can I provide?
> 
> > Thanks,  
> > Bryan
> 
> > [Allow search to continue when sort field is missing from type mapping · Issue #1558 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1558)

---

<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:44am UTC](https://discuss.elastic.co/t/bug-with-issue-1558-allow-search-to-continue-when-sort-field-is-missing-from-type-mapping/6257/4 "2017-07-06T03:44:08Z")

</div>


