# Percolating unknown document fields, using copy\_to as work around

**URL:** <https://discuss.elastic.co/t/percolating-unknown-document-fields-using-copy-to-as-work-around/171614>\
**Category:** Elasticsearch\
**Created:** [March 10, 2019, 2:08am UTC](https://discuss.elastic.co/t/percolating-unknown-document-fields-using-copy-to-as-work-around/171614 "2019-03-10T02:08:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![autorock](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@autorock](https://discuss.elastic.co/u/autorock)\
**Post date:** [March 10, 2019, 2:08am UTC](https://discuss.elastic.co/t/percolating-unknown-document-fields-using-copy-to-as-work-around/171614/1 "2019-03-10T02:08:41Z")

</div>

I've been experimenting with percolator, but it seems I can't add queries for fields that have no mappings. This would be really useful for me. I was wondering if it would be possible to use copy\_to to in a dynamic template to copy the path AND the value for any string fields. For an example, I could have a known mapped nested type field that contains 2 properties: path and value. Then I could dynamically copy string field values into the value property, and the path that the string field was found in to the path property.

Is there anyway for me to write a percolator query for a field that the index has no mapping for even though we dynamically map these?

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [March 15, 2019, 10:03am UTC](https://discuss.elastic.co/t/percolating-unknown-document-fields-using-copy-to-as-work-around/171614/2 "2019-03-15T10:03:58Z")

</div>

The percolator field mapping needs to know field mapping of fields in the query, otherwise it doesn't know how to parse the query correctly. For example you may have custom text analysis, but if the field hasn't been defined, it doesn't know analyzers to use.

There is an option that allows unmapped fields to be handled as default text fields: [https://www.elastic.co/guide/en/elasticsearch/reference/6.6/percolator.html#\_forcing\_unmapped\_fields\_to\_be\_handled\_as\_stringse](https://www.elastic.co/guide/en/elasticsearch/reference/6.6/percolator.html#_forcing_unmapped_fields_to_be_handled_as_stringse)

Maybe that helps in your case. However it is recommended to define the mapping prior to indexing the percolator if possible.

---

<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:** [April 12, 2019, 10:03am UTC](https://discuss.elastic.co/t/percolating-unknown-document-fields-using-copy-to-as-work-around/171614/3 "2019-04-12T10:03:59Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
