ES 5.4.0 Range query return wrong result

  1. Elasticsearch version 5.4.0

  2. JVM 1.8

  3. Index mapping:
    {
    "eastmoney": {
    "mappings": {
    "doc": {
    "properties": {
    "content": {
    "type": "keyword",
    "ignore_above": 20
    },
    "crawlertime": {
    "type": "float"
    },
    "files": {
    "type": "keyword"
    },
    "keyid": {
    "type": "keyword"
    },
    "publishtime": {
    "type": "date",
    "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
    },
    "sdb": {
    "type": "keyword"
    },
    "stockcode": {
    "type": "keyword"
    },
    "stockname": {
    "type": "text",
    "analyzer": "my_ana"
    },
    "tag": {
    "type": "keyword"
    },
    "title": {
    "type": "text",
    "analyzer": "my_ana"
    },
    "url": {
    "type": "keyword"
    }
    }
    }
    }
    }
    }

  4. Query:

    {
    "_source": "crawlertime",
    "sort": [
    {"crawlertime": {"order": "desc"}}
    ],
    "query":{
    "bool":{
    "must": [{"range": {"crawlertime": {"lte": 1530505048866}}}]
    }
    }

}

  1. Result:
    {
    "took": 7,
    "timed_out": false,
    "_shards": {
    "total": 1,
    "successful": 1,
    "failed": 0
    },
    "hits": {
    "total": 61317,
    "max_score": null,
    "hits": [
    {
    "_index": "eastmoney",
    "_type": "doc",
    "_id": "AN201807011161506068",
    "_score": null,
    "_source": {
    "crawlertime": 1530505047304
    },
    "sort": [
    1530505070000
    ]
    },
    {
    "_index": "eastmoney",
    "_type": "doc",
    "_id": "AN201807011161506070",
    "_score": null,
    "_source": {
    "crawlertime": 1530505047145
    },
    "sort": [
    1530505070000
    ]
    },
    {
    "_index": "eastmoney",
    "_type": "doc",
    "_id": "AN201807011161517275",
    "_score": null,
    "_source": {
    "crawlertime": 1530505047593
    },
    "sort": [
    1530505070000
    ]
    },
    {
    "_index": "eastmoney",
    "_type": "doc",
    "_id": "AN201807011161517302",
    "_score": null,
    "_source": {
    "crawlertime": 1530505047778
    },
    "sort": [
    1530505070000
    ]
    },
    {
    "_index": "eastmoney",
    "_type": "doc",
    "_id": "AN201807011161517277",
    "_score": null,
    "_source": {
    "crawlertime": 1530505047130
    },
    "sort": [
    1530505070000
    ]
    },
    {
    "_index": "eastmoney",
    "_type": "doc",
    "_id": "AN201807011161517198",
    "_score": null,
    "_source": {
    "crawlertime": 1530505047107
    },
    "sort": [
    1530505070000
    ]
    },
    {
    "_index": "eastmoney",
    "_type": "doc",
    "_id": "AN201807011161517129",
    "_score": null,
    "_source": {
    "crawlertime": 1530505047861
    },
    "sort": [
    1530505070000
    ]
    },
    {
    "_index": "eastmoney",
    "_type": "doc",
    "_id": "AN201807011161516494",
    "_score": null,
    "_source": {
    "crawlertime": 1530505047632
    },
    "sort": [
    1530505070000
    ]
    },
    {
    "_index": "eastmoney",
    "_type": "doc",
    "_id": "AN201807011161514068",
    "_score": null,
    "_source": {
    "crawlertime": 1530505048875
    },
    "sort": [
    1530505070000
    ]
    },
    {
    "_index": "eastmoney",
    "_type": "doc",
    "_id": "AN201807011161514069",
    "_score": null,
    "_source": {
    "crawlertime": 1530505048984
    },
    "sort": [
    1530505070000
    ]
    }
    ]
    }
    }

Query with range on crawlertime, return wrong result, some item in hits with larger crawlertime bug is appened int the response

How can I resolve this problem? Is this a known bugs? Is this bugs resolved in the newest version?

The problem is that crawlertime is a float.
Change its type to a long.

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