Term filter on field mapped to "integer" fails - a bug?

There seems to be a bug on term-filter when using it on "integer"-mapped
fields. The field "position" is mapped to "integer" and does not match to
term-filter. This is the mapping:

"position" : {
"type": "integer"
}

And this the the search request:

{
"from": 0,
"size": 10,
"sort": [
{}
],
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"bool": {
"must": [
{
"bool": {
"should": [
{
"term": {
"position": "1"
}
}
]
}
},
{
"type": {
"value": "my-test-type"
}
}
]
}
}
}
}
}

Also there is no difference when using this expression:

...
"term": {
"position": 1
}
...

Curisously the same query on a "long" field does perfectly match. Seems ES
cannot detect "long" for a value of "1"!?

Is this an elasticsearch bug? Where is the error?

regards,
markus

--
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/92c8d00b-ab67-4a58-aabf-9ee1d42d3290%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I replaced the "bool" filter with "and" filter, but the result is the same.
The same data was written to a different type within the ES index, but with
mapping of "string" instead of "integer". "string" and "long" always work
as expected, but the field mapped to "integer" never matches the term
query. There is no hint of such behavior in the ES manuals.

Any idea?

{
"from": 0,
"size": 10,
"sort": [
{}
],
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": [
{
"term": {
"position": "1"
}
},
{
"type": {
"value": "my-test-type"
}
}
]
}
}
}
}

--
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/9d069565-b96c-4558-b573-0551a9450479%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

The affected "integer" fields take no effect for sorting. It looks like
store only, the result document contains values. But the field itself is
not searchable.

When creating index with mapping to "long" al lis fine. Does any one have
an idea?

--
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/7096839c-2baa-42e9-91da-b47c634f2c7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

The same data was written to a different type within the ES index, but
with mapping of "string" instead of "integer".

This is probably the source of the bug, Elasticsearch is still aware of
this mapping and tries to search your field as if it was a string field,
while it's actually encoded as an integer field. In general you should
avoid having the same field name mapped to different types in the same
index, this is something that does not work well.

On Tue, Feb 3, 2015 at 7:23 AM, msbreuer@gmail.com wrote:

The affected "integer" fields take no effect for sorting. It looks like
store only, the result document contains values. But the field itself is
not searchable.

When creating index with mapping to "long" al lis fine. Does any one have
an idea?

--
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/7096839c-2baa-42e9-91da-b47c634f2c7a%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/7096839c-2baa-42e9-91da-b47c634f2c7a%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
Adrien Grand

--
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/CAL6Z4j5vmwJfNpqYnk%3D%3DFVso8n_ppo7oiMw0Hm8U9r7uqGGvyQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.