ES 9.1 query with "range" facets over dates may produce invalid conversion from "to" to "to_str"


(Jack Key) #1

Using ES 9.1 snapshot from 2010-08-02.

After running the following range facet query using dates, I found that the "to" provided in the query green did not match the "to_str" listed in result red.
It almost looks like the "to_str" in the result is being derived from the "from" value instead.
Has anyone else noticed this?

<query.sh>
#!/bin/bash

curl -XPOST localhost:9200/biocompare/Antibodies/_search -d '
{
"from" : 0,
"size" : 0,
"query" : {
"match_all" : { }
},
"facets" : {
"range1" : {
"range" : {
"field" : "modified",
"ranges" : [
{
"from" : "2000-01-01T00:00:00",
"to" : "2010-01-01T00:00:00"
},
{
"from" : "2010-01-01T00:00:00",
"to" : "2010-02-01T00:00:00"
}
]
}
}
}
}
' | python -mjson.tool
</query.sh>


{
"_shards": {
"failed": 0,
"successful": 5,
"total": 5
},
"facets": {
"range1": {
"_key_field": "modified",
"_type": "range",
"_value_field": "modified",
"ranges": [
{
"count": 99,
"from": 946684800000.0,
"from_str": "2000-01-01T00:00:00",
"mean": 1225301118181.8181,
"to": 1262304000000.0,
"to_str": "2000-01-01T00:00:00",
"total": 121304810700000.0
},
{
"count": 0,
"from": 1262304000000.0,
"from_str": "2010-01-01T00:00:00",
"mean": "NaN",
"to": 1264982400000.0,
"to_str": "2010-01-01T00:00:00",
"total": 0.0
}
]
}
},
"hits": {
"hits": [],
"max_score": 1.0,
"total": 884801
}
}

Regards, Jack


(Shay Banon) #2

Almost looks like? Exactly looks like ;). Pushed a fix to master. By the
way, I am not too happy with the naming I gave it (to_str and from_str,
pretty lacking on the imaginary side). I do want to return in the to / from
the actual numeric values that were used for the range test (a date, at the
end, is stored as a long).

-shay.banon

On Wed, Aug 11, 2010 at 11:29 PM, Jack Key joeandrewkey@gmail.com wrote:

Using ES 9.1 snapshot from 2010-08-02.

After running the following range facet query using dates, I found that the
"to" provided in the query green did not match the "to_str" listed in
result
red.
It almost looks like the "to_str" in the result is being derived from the
"from" value instead.
Has anyone else noticed this?

<query.sh>
#!/bin/bash

curl -XPOST localhost:9200/biocompare/Antibodies/_search -d '
{
"from" : 0,
"size" : 0,
"query" : {
"match_all" : { }
},
"facets" : {
"range1" : {
"range" : {
"field" : "modified",
"ranges" : [
{
"from" : "2000-01-01T00:00:00",
"to" : "2010-01-01T00:00:00"
},
{
"from" : "2010-01-01T00:00:00",
"to" : "2010-02-01T00:00:00"
}
]
}
}
}
}
' | python -mjson.tool
</query.sh>

{ "_shards": { "failed": 0, "successful": 5, "total": 5 }, "facets": { "range1": { "_key_field": "modified", "_type": "range", "_value_field": "modified", "ranges": [ { "count": 99, "from": 946684800000.0, "from_str": "2000-01-01T00:00:00", "mean": 1225301118181.8181, "to": 1262304000000.0, "to_str": "2000-01-01T00:00:00", "total": 121304810700000.0 }, { "count": 0, "from": 1262304000000.0, "from_str": "2010-01-01T00:00:00", "mean": "NaN", "to": 1264982400000.0, "to_str": "2010-01-01T00:00:00", "total": 0.0 } ] } }, "hits": { "hits": [], "max_score": 1.0, "total": 884801 } }

Regards, Jack

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/ES-9-1-query-with-range-facets-over-dates-may-produce-invalid-conversion-from-to-to-to-str-tp1093130p1093130.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(system) #3