hi,guys. I got a problem when i am using search mothed with term query.
I write two similar curl commands, the only different part is the query aims at different fields in the same document. But one is success, the other is failed. I can't figure out where I am wrong, so please help me. Many Thanks.
Here are the commands and their results:
The success command:
$ curl -XGET 'http://localhost:9200/cmongo_statistics/cmongo_cluster_info/_search?pretty' -d '{"query":{"term":{"region_id":1}}}'0
The right result:
{
"took" : 8,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 76,
"max_score" : 0.9780211,
"hits" : [ {
"_index" : "cmongo_statistics",
"_type" : "cmongo_cluster_info",
"_id" : "AVTtMUejStKgUadx78sX",
"_score" : 0.9780211,
"_source" : {
"region_id" : 1,
"cluster_id" : "cmgo-79rjj8o3",
"all_storage" : 30720,
"timestamp" : 1464268310
}
}, { ...
The wrong command:
curl -XGET 'http://localhost:9200/cmongo_statistics/cmongo_cluster_info/_search?pretty' -d '{"query":{"term":{"cluster_id" : "cmgo-79rjj8o3"}}}'
The wrong result:
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
command contrast
the success one:
curl -XGET 'http://localhost:9200/cmongo_statistics/cmongo_cluster_info/_search?pretty' -d '{"query":{"term":{"region_id":1}}}'0
the failed one:
curl -XGET 'http://localhost:9200/cmongo_statistics/cmongo_cluster_info/_search?pretty' -d '{"query":{"term":{"cluster_id" : "cmgo-79rjj8o3"}}}'