Hi,
when I using Query DSL in kibana console:
GET newtest/_search
{
"query":{
"terms":{"_id":["abcdefghij"]}
}
}
I got:
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [
{
"_index" : "newtest",
"_type" : "newtest",
"_id" : "abcdefghij",
"_score" : 1.0,
"_source" : {
"field1" : "testtesttest",
"field2" : {
"try1" : "n/a",
"hahaha" : "123",
"abc" : {
"Cluster0" : {
"F" : "1",
"Num" : "8"
}
},
"Date" : "20170516"
},
"Result" : {
"ggg" : "69",
"kfx" : "40",
"yxe" : "57",
"1ee3r" : "52"
}
}
}
]
}
}
and using elasticsearch-py :
res = _ES.search( index = newtest, body = {
"query": {
"terms": {
"_id": ["abcdefghij"]
}
}
})
print res['hits']
return res['hits']
I got:
{u'_score': 1.0,
u'_type': u'newtest',
u'_id': u'abcdefghij',
u'_source': {
u'field2': {
u'Date': u'20170516',
u'abc': {
u'Cluster0': {
u'Num': u'8',
u'F': u'1'
}
},
u'try1': u'n/a',
u'hahaha': u'123'
},
u'field1': u'testtesttest',
u'Result': {
u'ggg': u'69',
u'1ee3r': u'52',
u'kfx': u'40',
u'yxe': u'57'
}
},
u'_index': u'newtest'
}
the return fields order between two methods are not the same at all,
how to do to get the same order's result?