# Ignoring unmapped fields in queries

**URL:** <https://discuss.elastic.co/t/ignoring-unmapped-fields-in-queries/12342>\
**Category:** Elasticsearch\
**Created:** [June 10, 2013, 9:45am UTC](https://discuss.elastic.co/t/ignoring-unmapped-fields-in-queries/12342 "2013-06-10T09:45:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Klaus\_Brunner](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@Klaus\_Brunner](https://discuss.elastic.co/u/Klaus_Brunner)\
**Post date:** [June 10, 2013, 9:45am UTC](https://discuss.elastic.co/t/ignoring-unmapped-fields-in-queries/12342/1 "2013-06-10T09:45:33Z")

</div>

Is there any way to gracefully ignore unmapped fields in queries, instead  
of failing the query?

Background: our data may not always contain certain fields, but our queries  
will still look for them. It would be nice to have a way of saying, "if the  
mapping for the field(s) is not there, just consider the query unmatched  
and don't complain".

I've found similar issues, but not a general way of dealing with this in  
queries ([https://github.com/elasticsearch/elasticsearch/issues/2569](https://github.com/elasticsearch/elasticsearch/issues/2569),  
[https://github.com/elasticsearch/elasticsearch/issues/1558](https://github.com/elasticsearch/elasticsearch/issues/1558)).

Completely switching off dynamic mapping is theoretically a solution, but  
would be pretty cumbersome for us.

Thanks

Klaus

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Klaus\_Brunner](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@Klaus\_Brunner](https://discuss.elastic.co/u/Klaus_Brunner)\
**Post date:** [June 11, 2013, 8:09am UTC](https://discuss.elastic.co/t/ignoring-unmapped-fields-in-queries/12342/2 "2013-06-11T08:09:50Z")

</div>

It seems that the problem is actually in a custom score script of ours, not  
the standard ES queries. Sorry for the confusion!

On Monday, 10 June 2013 11:45:33 UTC+2, Klaus Brunner wrote:

> Is there any way to gracefully ignore unmapped fields in queries, instead  
> of failing the query?
> 
> Background: our data may not always contain certain fields, but our  
> queries will still look for them. It would be nice to have a way of saying,  
> "if the mapping for the field(s) is not there, just consider the query  
> unmatched and don't complain".
> 
> I've found similar issues, but not a general way of dealing with this in  
> queries ([Allow facet "queries" to run against unmapped fields · Issue #2569 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/2569),  
> [Allow search to continue when sort field is missing from type mapping · Issue #1558 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1558)).
> 
> Completely switching off dynamic mapping is theoretically a solution, but  
> would be pretty cumbersome for us.
> 
> Thanks
> 
> Klaus

--  
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).  
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, 2:31am UTC](https://discuss.elastic.co/t/ignoring-unmapped-fields-in-queries/12342/3 "2017-07-06T02:31:53Z")

</div>


