Home > other >  Can I get a specific order of fields on Eleasticsearch?
Can I get a specific order of fields on Eleasticsearch?

Time:03-08

I requested like :

{
  "_source" :{
   "fields2",
   "fields3",
   "fields1"
  }
}

Expected response looks like :

{ - 
   "_source": { - 
      "field2": "data2",
      "field3": "data3",
      "field1": "data1",
   }
}

But the response I've got looks like:

{ - 
   "_source": { - 
      "field1": "data1",
      "field2": "data2",
      "field3": "data3",
   }
}

Can I custom a specific order on Eleasticsearch?

CodePudding user response:

No, You cant get _source value in specific order. The source document is a plain old JSON object as define here:

An object is an unordered set of name/value pairs.

Please read this comment on github issue which will give you more understanding of why it is not possible.

  • Related