Ignoring unmapped fields in queries

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/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.
For more options, visit https://groups.google.com/groups/opt_out.

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,
Allow search to continue when sort field is missing from type mapping · Issue #1558 · elastic/elasticsearch · GitHub).

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.
For more options, visit https://groups.google.com/groups/opt_out.