How to do sort in using on particular field

后端 未结 2 1079
一个人的身影
一个人的身影 2021-01-26 01:35

I have a document

How to do sort in using on particular field on elasticsearch

My query is below

{
   "sort":{
      "name":&qu         


        
2条回答
  •  独厮守ぢ
    2021-01-26 02:17

    you can make a PUT request on the index to set fielddata as true:

    curl --location --request PUT 'http://localhost:9200/index_name/info/_mapping' \
    --header 'Content-Type: application/json' \
    --data-raw '{
      "properties": {
         "desc": { 
           "type":     "text",
           "fielddata": true
         }
      }
    }'
    

    where desc is the column name

提交回复
热议问题