# how to suppress ElasticSearchIllegalArgumentException\[failed to find mappings for \[object1.object2.field\]\]; }\] errors

**URL:** <https://discuss.elastic.co/t/how-to-suppress-elasticsearchillegalargumentexception-failed-to-find-mappings-for-object1-object2-field-errors/9586>\
**Category:** Elasticsearch\
**Created:** [November 6, 2012, 9:55pm UTC](https://discuss.elastic.co/t/how-to-suppress-elasticsearchillegalargumentexception-failed-to-find-mappings-for-object1-object2-field-errors/9586 "2012-11-06T21:55:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![revdev](https://avatars.discourse-cdn.com/v4/letter/r/ecb155/32.png) [@revdev](https://discuss.elastic.co/u/revdev)\
**Post date:** [November 6, 2012, 9:55pm UTC](https://discuss.elastic.co/t/how-to-suppress-elasticsearchillegalargumentexception-failed-to-find-mappings-for-object1-object2-field-errors/9586/1 "2012-11-06T21:55:05Z")

</div>

I am performing a facet query on a dynamic object field but if field is not  
already indexed, I get an error  
"ElasticSearchIllegalArgumentException[failed to find mappings for  
[object1.object2.field]]; }]" since it is not available in the mapping. Is  
there anyway to suppress that warming and just return no results ?  
Thanks!  
Vinay

--

---

<div class="post-metadata">

**Author:** ![revdev](https://avatars.discourse-cdn.com/v4/letter/r/ecb155/32.png) [@revdev](https://discuss.elastic.co/u/revdev)\
**Post date:** [November 7, 2012, 5:58am UTC](https://discuss.elastic.co/t/how-to-suppress-elasticsearchillegalargumentexception-failed-to-find-mappings-for-object1-object2-field-errors/9586/2 "2012-11-07T05:58:47Z")

</div>

Any idea how to suppress these errors? Otherwise, I need to keep track of  
what all dynamic fields were indexed and then request only those which is  
not ideal.  
thanks in advance.

On Tuesday, November 6, 2012 1:55:05 PM UTC-8, revdev wrote:

> I am performing a facet query on a dynamic object field but if field is  
> not already indexed, I get an error  
> "ElasticSearchIllegalArgumentException[failed to find mappings for  
> [object1.object2.field]]; }]" since it is not available in the mapping. Is  
> there anyway to suppress that warming and just return no results ?  
> Thanks!  
> Vinay

--

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [November 7, 2012, 9:10am UTC](https://discuss.elastic.co/t/how-to-suppress-elasticsearchillegalargumentexception-failed-to-find-mappings-for-object1-object2-field-errors/9586/3 "2012-11-07T09:10:02Z")

</div>

Hello,

What do you mean by "facet query"? Can you provide some sample data  
and a sample query?

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

On Wed, Nov 7, 2012 at 7:58 AM, revdev [clickingcam@gmail.com](mailto:clickingcam@gmail.com) wrote:

> Any idea how to suppress these errors? Otherwise, I need to keep track of  
> what all dynamic fields were indexed and then request only those which is  
> not ideal.  
> thanks in advance.
> 
> On Tuesday, November 6, 2012 1:55:05 PM UTC-8, revdev wrote:
> 
> > I am performing a facet query on a dynamic object field but if field is  
> > not already indexed, I get an error  
> > "ElasticSearchIllegalArgumentException[failed to find mappings for  
> > [object1.object2.field]]; }]" since it is not available in the mapping. Is  
> > there anyway to suppress that warming and just return no results ?  
> > Thanks!  
> > Vinay
> 
> --

--

---

<div class="post-metadata">

**Author:** ![Chris\_Male](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chris_male/32/2607_2.png) [@Chris\_Male](https://discuss.elastic.co/u/Chris_Male)\
**Post date:** [November 7, 2012, 10:26am UTC](https://discuss.elastic.co/t/how-to-suppress-elasticsearchillegalargumentexception-failed-to-find-mappings-for-object1-object2-field-errors/9586/4 "2012-11-07T10:26:43Z")

</div>

Hi,

What would you like to happen instead of the error? The error is reporting  
that the mapping wasn't found and so it cannot create any facet information.

On Wednesday, November 7, 2012 4:58:47 PM UTC+11, revdev wrote:

> Any idea how to suppress these errors? Otherwise, I need to keep track of  
> what all dynamic fields were indexed and then request only those which is  
> not ideal.  
> thanks in advance.
> 
> On Tuesday, November 6, 2012 1:55:05 PM UTC-8, revdev wrote:
> 
> > I am performing a facet query on a dynamic object field but if field is  
> > not already indexed, I get an error  
> > "ElasticSearchIllegalArgumentException[failed to find mappings for  
> > [object1.object2.field]]; }]" since it is not available in the mapping. Is  
> > there anyway to suppress that warming and just return no results ?  
> > Thanks!  
> > Vinay

--

---

<div class="post-metadata">

**Author:** ![revdev](https://avatars.discourse-cdn.com/v4/letter/r/ecb155/32.png) [@revdev](https://discuss.elastic.co/u/revdev)\
**Post date:** [November 7, 2012, 5:01pm UTC](https://discuss.elastic.co/t/how-to-suppress-elasticsearchillegalargumentexception-failed-to-find-mappings-for-object1-object2-field-errors/9586/5 "2012-11-07T17:01:40Z")

</div>

Thanks Chris, Radu for helping out!

Here is my scenario: The reason I chose dynamic mapping (via templates) is  
that I am not completely aware of what fields will be indexed (thus mapped)  
on the fly. If I knew the exact range/domain of fields that I would  
encounter, I would have created explicit mappings. So, if I query (any  
facet query) for say 100 such fields and even if 1 of them is absent, I get  
an exception from ES with "missing mapping" error. This means that I am  
required to know what fields are already mapped before sending a query  
which makes dynamic mapping less useful to me. I would love to get response  
for other 99 fields which were present in the mapping rather than a failed  
query. ES can just skip the fields that are not present in mapping. Does it  
make sense?

Thanks!  
Vinay

On Wednesday, November 7, 2012 2:26:43 AM UTC-8, Chris Male wrote:

> Hi,
> 
> What would you like to happen instead of the error? The error is reporting  
> that the mapping wasn't found and so it cannot create any facet information.
> 
> On Wednesday, November 7, 2012 4:58:47 PM UTC+11, revdev wrote:
> 
> > Any idea how to suppress these errors? Otherwise, I need to keep track of  
> > what all dynamic fields were indexed and then request only those which is  
> > not ideal.  
> > thanks in advance.
> > 
> > On Tuesday, November 6, 2012 1:55:05 PM UTC-8, revdev wrote:
> > 
> > > I am performing a facet query on a dynamic object field but if field is  
> > > not already indexed, I get an error  
> > > "ElasticSearchIllegalArgumentException[failed to find mappings for  
> > > [object1.object2.field]]; }]" since it is not available in the mapping. Is  
> > > there anyway to suppress that warming and just return no results ?  
> > > Thanks!  
> > > Vinay

--

---

<div class="post-metadata">

**Author:** ![drewr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drewr/32/7803_2.png) [@drewr](https://discuss.elastic.co/u/drewr)\
**Post date:** [November 7, 2012, 7:37pm UTC](https://discuss.elastic.co/t/how-to-suppress-elasticsearchillegalargumentexception-failed-to-find-mappings-for-object1-object2-field-errors/9586/6 "2012-11-07T19:37:34Z")

</div>

revdev wrote:

> Here is my scenario: The reason I chose dynamic mapping (via  
> templates) is that I am not completely aware of what fields will be  
> indexed (thus mapped) on the fly.

ES will update the mapping for you, so you don't need templates just  
for that case. You could issue a call to /index/\_mapping and inspect  
what fields exist, then construct your facet query from there.

-Drew

--

---

<div class="post-metadata">

**Author:** ![revdev](https://avatars.discourse-cdn.com/v4/letter/r/ecb155/32.png) [@revdev](https://discuss.elastic.co/u/revdev)\
**Post date:** [November 7, 2012, 7:41pm UTC](https://discuss.elastic.co/t/how-to-suppress-elasticsearchillegalargumentexception-failed-to-find-mappings-for-object1-object2-field-errors/9586/7 "2012-11-07T19:41:12Z")

</div>

Thanks Drew.

- The reason I used templates is because I want to enforce specific date  
type for the incoming fields so that faceting operation doesnt take too  
much RAM.
- Yes, I can query mappings api to get extract existing mappings but that  
adds 50-100ms to each of my queries. I can cache it in memcached but still  
its added code complexity.

I am just wondering why ES returns an error message vs skipping data for  
the field? If there is a setting to disable error in this scenario, it  
would solve my problem.

Vinay

On Wednesday, November 7, 2012 11:37:30 AM UTC-8, Drew Raines wrote:

> revdev wrote:
> 
> > Here is my scenario: The reason I chose dynamic mapping (via  
> > templates) is that I am not completely aware of what fields will be  
> > indexed (thus mapped) on the fly.
> 
> ES will update the mapping for you, so you don't need templates just  
> for that case. You could issue a call to /index/\_mapping and inspect  
> what fields exist, then construct your facet query from there.
> 
> -Drew

--

---

<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:05am UTC](https://discuss.elastic.co/t/how-to-suppress-elasticsearchillegalargumentexception-failed-to-find-mappings-for-object1-object2-field-errors/9586/8 "2017-07-06T03:05:36Z")

</div>


