# Strange query sentence（can pass in Kibana but failed when Unmarshal）

**URL:** <https://discuss.elastic.co/t/strange-query-sentence-can-pass-in-kibana-but-failed-when-unmarshal/108528>\
**Category:** Elasticsearch\
**Created:** [November 21, 2017, 7:47am UTC](https://discuss.elastic.co/t/strange-query-sentence-can-pass-in-kibana-but-failed-when-unmarshal/108528 "2017-11-21T07:47:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rabbitxin](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@rabbitxin](https://discuss.elastic.co/u/rabbitxin)\
**Post date:** [November 21, 2017, 7:47am UTC](https://discuss.elastic.co/t/strange-query-sentence-can-pass-in-kibana-but-failed-when-unmarshal/108528/1 "2017-11-21T07:47:21Z")

</div>

hi all:  
i have a sentence to query a group of users by terms (keyword field present uid) and with a range limit (long filed present unixtime ),the sentence can be executed in Kibana and curl, but when I use golang client([https://github.com/olivere/elastic](https://github.com/olivere/elastic)) to perform the query, after json. Unmarshal(), the sentence is tampered,the range request is abandoned, why? my sentence disobey the json's rule?

mapping:  
"index" : {  
"type": {  
"uid":{  
"type":"keyword"  
},  
"unixtime":{  
"type":"long"  
}  
}  
}  
sentence in Kibana:  
GET /index/type/\_search?pretty  
{  
"query" : {  
"constant\_score" : {  
"filter" : {  
"bool" : {  
"filter" : {  
"range" : {  
"time" : { "gte" : 1, "lte" : 1234321 }  
}  
},  
"filter" : {  
"terms" : {  
"uid" : ["18888", "678","8888","654"]  
}  
}  
}  
}  
}  
}  
}

sentence in golang program (before Unmarshal, it's right):  
{"constant\_score" : {"filter" : {"bool" : {"filter" : {"range" : {"time" : {"gte" : 1, "lte" : 1234321}}}, "filter" : {"terms" : {"uid" : ["18888", "678","8888","654"]}}}}}}

sentence in golang program(after Unmarshal, **range clause disappeared**... ):  
map[constant\_score:map[filter:map[bool:map[filter:map[terms:map[uid:[18888 678 8888 654]]]]]]]

waiting answers ...

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 19, 2017, 7:52am UTC](https://discuss.elastic.co/t/strange-query-sentence-can-pass-in-kibana-but-failed-when-unmarshal/108528/2 "2017-12-19T07:52:40Z")

</div>

Closed on December 19, 2017, 7:52am UTC

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