小编aas*_*ish的帖子

Elasticsearch 按日期排序不起作用

我在弹性搜索上按日期排序时遇到问题。根据elasticsearch提供的文档http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/_sorting.html

我使用以下代码按日期排序

{"sort":{"posted_on":{"order":"desc"}}}
Run Code Online (Sandbox Code Playgroud)

以下是结果

{
"took": 3,
"timed_out": false,
"_shards": {
    "total": 1,
    "successful": 1,
    "failed": 0
},
"hits": {
    "total": 305,
    "max_score": null,
    "hits": [
        {
            "_index": "ads",
            "_type": "ad",
            "_id": "52d6945f1d41c812bf000004",
            "_score": null,
            "_source": {
                "category": "Cars and Bikes",
                "description": "Innova 2010(V) DC",
                "posted_on": "2014-09-04T18:11:57+00:00",
                "slug_id": "innova-2010-v-dc",
                "title": "Innova 2010(V) DC"
            },
            "sort": [
                "57"
            ]
        }
        ,
        {
            "_index": "ads",
            "_type": "ad",
            "_id": "5408accf1d41c8b8f1000001",
            "_score": null,
            "_source": {
                "category": "",
                "description": "rrrrrrrrrrfsadsadfsadfsa",
                "posted_on": "2014-09-04T18:11:57+00:00",
                "slug_id": "test", …
Run Code Online (Sandbox Code Playgroud)

elasticsearch

5
推荐指数
1
解决办法
9567
查看次数

标签 统计

elasticsearch ×1