jeudi 9 février 2017

elastic search : sort on text does not work inspite fielddate set to true

Vote count: 0

I am trying to sort a text typed field to which i set fielddate to true, but it gives me always the same order

this is my mapping:

 "movieTitle": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            },
            "analyzer": "french",
            "fielddata": true
          }

This is my request

POST /0802v6/movie/_search
{
  "from": 0,
  "size": 10,
  "min_score": 1,
  "sort": [
    {
      "movieTitle": {
        "order": "asc" //or desc
      }
    }
  ],

   "_source": "movieTitle",

  "query": {...}
}

Unfortunately I have always the same result wathever i set asc or desc. I can see the sort property does not contains the correct word

"hits": [ {
    "_index": "0802v6",
    "_type": "proj",
    "_id": "AVojCSjg8N13TOVDp6r2",
    "_score": null,
    "_source": {
      "movieTitle": "12 Years a Slave"
    },
    "sort": [
      "12"
    ]
  },
  {
    "_index": "0802v6",
    "_type": "proj",
    "_id": "AVojCSg58N13TOVDp6pV",
    "_score": null,
    "_source": {
      "movieTitle": "black wing has my angel"
    },
    "sort": [
      "angel"
    ]
  },
  {
    "_index": "0802v6",
    "_type": "proj",
    "_id": "AVojCSjg8N13TOVDp6qT",
    "_score": null,
    "_source": {
      "movieTitle": "TO DO LIST (THE)"
    },
    "sort": [
      "do"
    ]
  },
  {
    "_index": "0802v6",
    "_type": "proj",
    "_id": "AVojCSo28N13TOVDp68w",
    "_score": null,
    "_source": {
      "movieTitle": "Third Person"
    },
    "sort": [
      "person"
    ]
  }

  ]

Do you know what happens and how to fix it please?

asked 27 secs ago

Let's block ads! (Why?)



elastic search : sort on text does not work inspite fielddate set to true

Aucun commentaire:

Enregistrer un commentaire