Unable to query hash value generated from (zero-allocation-hashing ) algorithm - from ES 2.3

I have stored array of hash values in a document but unable to query based on hash. Please help

Here the index details

  1. Field name is bids and it stores array of hash values
    {"properties": {"bids":{"type":"long"}}}

  2. Sample document

hits: [
{
_index: "myindex",
_type: "myinfo",
_id: "C18B18",
_score: 1,
_source: {
uid:10
bids: [
3468197663136215600,
-9068197663136215600
]
}
}
]

  1. Query

curl -XGET 'http://localhost:9200/myindex/myinfo/_search?pretty' -d'
{
"size":1,
"query": {

"filtered" : {
"query" : {
"query_string" : {
"query": "( bids:3468197663136215600 )"
}
}
}
}
}'

Result I see is

{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 2,
"successful" : 2,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

I should get total =1, but I am seeing total =0.

some one please help me.

Found the issue.
it seems Elastic search trimming the last 2 digit and adding "00"

my original value 3468197663136215679 but ES store as 3468197663136215600

this caused me to not able to query.

You should be getting exact responses if you instead store them as string in the JSON request as large numbers lose precision in JSON/JavaScript.

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