Query in DSL
GET prv_charge_data_extract/_search
{
"_source": ["chargeInUSD","chargeInCntryCurr","exchangeRate"],
"query": {
"terms": {
"docID": [
"c806e6213793f13726ed2cdb95b439b97e5011ec",
"ad2a5fb4bf83f9b71947d8acf1a3a28b58d9115a"
]
}
}
}
Result -:
{
"_index" : "prv_charge_data_extract",
"_type" : "_doc",
"_id" : "ad2a5fb4bf83f9b71947d8acf1a3a28b58d9115a",
"_score" : 1.0,
"_source" : {
"chargeInUSD" : 472.4606038057,
"exchangeRate" : 0.817084,
"chargeInCntryCurr" : 386.04
}
},
{
"_index" : "prv_charge_data_extract",
"_type" : "_doc",
"_id" : "c806e6213793f13726ed2cdb95b439b97e5011ec",
"_score" : 1.0,
"_source" : {
"chargeInUSD" : 195.5008179837,
"exchangeRate" : 0.735956,
"chargeInCntryCurr" : 143.88
}
}
Query IN SQL -:
GET _sql?format=txt
{
"query":"""
SELECT docID, chargeInUSD, chargeInCntryCurr,exchangeRate FROM prv_charge_data_extract
WHERE docID in ('c806e6213793f13726ed2cdb95b439b97e5011ec','ad2a5fb4bf83f9b71947d8acf1a3a28b58d9115a')
"""
}
Result -:
docID | chargeInUSD |chargeInCntryCurr| exchangeRate
----------------------------------------+------------------+-----------------+------------------
ad2a5fb4bf83f9b71947d8acf1a3a28b58d9115a|472.4606018066406 |386.0400085449219|0.817084014415741
c806e6213793f13726ed2cdb95b439b97e5011ec|195.50082397460938|143.8800048828125|0.7359560132026672
the bold highlighted values differs in SQL and DSL results. After i tried it many queries for different indices, i observed that the values for float datatype filed gives different result.