# Strange percolator behavior with extra field named "type"

**URL:** <https://discuss.elastic.co/t/strange-percolator-behavior-with-extra-field-named-type/16153>\
**Category:** Elasticsearch\
**Created:** [March 4, 2014, 11:27pm UTC](https://discuss.elastic.co/t/strange-percolator-behavior-with-extra-field-named-type/16153 "2014-03-04T23:27:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Bathgate\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james_bathgate_2/32/1758_2.png) [@James\_Bathgate\_2](https://discuss.elastic.co/u/James_Bathgate_2)\
**Post date:** [March 4, 2014, 11:27pm UTC](https://discuss.elastic.co/t/strange-percolator-behavior-with-extra-field-named-type/16153/1 "2014-03-04T23:27:22Z")

</div>

I've found a strange behavior where if I have an extra field in the  
percolator named "type" then range filters on my percolator don't work  
properly. See the following test case:

> <https://gist.github.com/julesbravo/9357887>

If I change the type field on lines 26 and 74 to "atype" OR change the type  
of the "ts" field to "string" on lines 47, 68 and 99 I get results as  
expected.

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/80ec258a-52ca-4ef1-9d5c-d8deff93dc6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/80ec258a-52ca-4ef1-9d5c-d8deff93dc6d%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![brian\_yoder](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@brian\_yoder](https://discuss.elastic.co/u/brian_yoder)\
**Post date:** [March 5, 2014, 12:07am UTC](https://discuss.elastic.co/t/strange-percolator-behavior-with-extra-field-named-type/16153/2 "2014-03-05T00:07:26Z")

</div>

What version of ES are you using? I seem to recall reading about ambiguity  
surrounding the use of "type" as a field name in one of the version's  
release notes, but I cannot find it quickly now.

However, ES seems to overuse the word "type", referring to both the  
document type (roughly analogous to a table) and a field's type (such as  
string, long, boolean, and so on). So for the sake of keeping things from  
being impossible to explain, I always avoid the use of type for the name of  
a type or field. For a worst-case example, "The type of the type field in  
type documents is string.". Yikes! It's much better to be able to say  
something like "The type of the given\_name field in person documents is  
string.".

Just a thought...

Brian

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a5a1fa34-7ef8-4c4b-86e3-ff0ff99d9ecf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a5a1fa34-7ef8-4c4b-86e3-ff0ff99d9ecf%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![James\_Bathgate\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james_bathgate_2/32/1758_2.png) [@James\_Bathgate\_2](https://discuss.elastic.co/u/James_Bathgate_2)\
**Post date:** [March 5, 2014, 12:11am UTC](https://discuss.elastic.co/t/strange-percolator-behavior-with-extra-field-named-type/16153/3 "2014-03-05T00:11:24Z")

</div>

Brian,

Using 1.0.0. You're probably right but I don't want to go back and change  
code in 1000 places if I can avoid it.

On Tuesday, March 4, 2014 4:07:26 PM UTC-8, InquiringMind wrote:

> What version of ES are you using? I seem to recall reading about ambiguity  
> surrounding the use of "type" as a field name in one of the version's  
> release notes, but I cannot find it quickly now.
> 
> However, ES seems to overuse the word "type", referring to both the  
> document type (roughly analogous to a table) and a field's type (such as  
> string, long, boolean, and so on). So for the sake of keeping things from  
> being impossible to explain, I always avoid the use of type for the name of  
> a type or field. For a worst-case example, "The type of the type field in  
> type documents is string.". Yikes! It's much better to be able to say  
> something like "The type of the given\_name field in person documents is  
> string.".
> 
> Just a thought...
> 
> Brian

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d69624ce-d1e9-4666-839e-a83c93c6b85e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d69624ce-d1e9-4666-839e-a83c93c6b85e%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 5, 2014, 8:48am UTC](https://discuss.elastic.co/t/strange-percolator-behavior-with-extra-field-named-type/16153/4 "2014-03-05T08:48:10Z")

</div>

Hi James,

The `type` top level field is used during registering the query to point to  
a mapping. This allows ES to properly resolve field names, so for example  
when indexing a query with a range query/filter it can get properly  
resolved to a numeric range query if a field is of the type number.

This is documented:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

In your can you should either set the type field to `trigger` or not use it  
all. ES should be able to resolve field `ts` in your query correctly if it  
is used in only one mapping.

Martijn

On 5 March 2014 01:11, James Bathgate [james@b7interactive.com](mailto:james@b7interactive.com) wrote:

> Brian,
> 
> Using 1.0.0. You're probably right but I don't want to go back and change  
> code in 1000 places if I can avoid it.
> 
> On Tuesday, March 4, 2014 4:07:26 PM UTC-8, InquiringMind wrote:
> 
> > What version of ES are you using? I seem to recall reading about  
> > ambiguity surrounding the use of "type" as a field name in one of the  
> > version's release notes, but I cannot find it quickly now.
> > 
> > However, ES seems to overuse the word "type", referring to both the  
> > document type (roughly analogous to a table) and a field's type (such as  
> > string, long, boolean, and so on). So for the sake of keeping things from  
> > being impossible to explain, I always avoid the use of type for the name of  
> > a type or field. For a worst-case example, "The type of the type field in  
> > type documents is string.". Yikes! It's much better to be able to say  
> > something like "The type of the given\_name field in person documents is  
> > string.".
> > 
> > Just a thought...
> > 
> > Brian
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/d69624ce-d1e9-4666-839e-a83c93c6b85e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d69624ce-d1e9-4666-839e-a83c93c6b85e%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/d69624ce-d1e9-4666-839e-a83c93c6b85e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/d69624ce-d1e9-4666-839e-a83c93c6b85e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
Met vriendelijke groet,

Martijn van Groningen

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CA%2BA76Tw89Q6Ctz\_qvq1r%2ByNf505%2B1EuzNfzLk63i3YB0N4\_TrQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CA%2BA76Tw89Q6Ctz_qvq1r%2ByNf505%2B1EuzNfzLk63i3YB0N4_TrQ%40mail.gmail.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, 1:45am UTC](https://discuss.elastic.co/t/strange-percolator-behavior-with-extra-field-named-type/16153/5 "2017-07-06T01:45:39Z")

</div>


