Strange percolator behavior with extra field named "type"


(James Bathgate-2) #1

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:

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.
To view this discussion on the web visit 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.


(Brian Yoder) #2

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.
To view this discussion on the web visit 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.


(James Bathgate-2) #3

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.
To view this discussion on the web visit 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.


(Martijn Van Groningen) #4

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:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-percolate.html#_indexing_percolator_queries

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 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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/d69624ce-d1e9-4666-839e-a83c93c6b85e%40googlegroups.comhttps://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.

--
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.
To view this discussion on the web visit 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.


(system) #5