Query array of keyword responce different in source and docfields

I have an mapping of keyword field, like below

PUT test-map
{  
  "mappings": {    
    "properties": {      
      "field": {        
        "type":  "keyword"      
      }    
    }  
  }
}

And I post a doc:

POST test-map/_doc
{
  "field": ["foo", "bar"]
}

Then query the doc like:

GET test-map/_search
{
  "docvalue_fields": ["field"]
}

which responce in different in source field and docvalue field:
In the source, the order of value is the insertion order, but the order of docvlaue fields is order by alphabet

    "hits" : [
      {
        "_index" : "test-map",
        "_type" : "_doc",
        "_id" : "IFwbJoABrlDVcd2g6k0w",
        "_score" : 1.0,
        "_source" : {
          "field" : [
            "foo",
            "bar"
          ]
        },
        "fields" : {
          "field" : [
            "bar",
            "foo"
          ]
        }
      }
    ]

I wonder is this a bug? and why is it different?

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