Sir !
All Things have been done perfectlly but result is unexpected please
help me -
'{
"filtered":
{
{"facet":{"query":{
"constant_score" : {
"filter" : {"or":[{
"range" : {
"date" : {
"to" : "2011-09-01",
"from" : "2011-09-10"
}
},"range":{"date":{"to":"2011-10-17","from":"2011-10-07"}}
}]
}
}
}}'
"query":
{
"constant_score" :
{
"filter" : {"or":[
{
"range" : {
"date" : {
"lte" : "2011-09-01",
"gte" : "2011-09-10"
}
},
"range":
{
"date":
{
"lte":"2011-10-17","gte": "2011-10-07"
}
}
}
]
}
}
}
}'
result is not right-
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 10,
"max_score" : 1.0,
"hits" : [ {
"_index" : "mydb2",
"_type" : "mytype2",
"_id" : "1628606f4283247f269be3f8ce007c41",
"_score" : 1.0, "_source" :
{"_rev":"5-1bbfb69b0f3e7bb45842a3f2d43b7d1d","
author":"jacky","_id":"1628606f4283247f269be3f8ce007c41","location":"austrelia",
"date":"2011-10-15","type":"x","msg":"known by kangaroo"}
}, {
"_index" : "mydb2",
"_type" : "mytype2",
"_id" : "5382de0ad052b255738f2de1ff075b9e",
"_score" : 1.0, "_source" :
{"_rev":"3-73140e3038c85f0c7a5a421f9a1d8d25","
author":"k.knight","_id":"5382de0ad052b255738f2de1ff075b9e","location":"delhi","
date":"2011-10-01","type":"x","msg":"hi hello"}
}, {
"_index" : "mydb2",
"_type" : "mytype2",
"_id" : "1628606f4283247f269be3f8ce00486f",
"_score" : 1.0, "_source" :
{"_rev":"3-1a50fdb7ab741b0f16d9c05bb8aacb71","
author":"duglus","_id":"1628606f4283247f269be3f8ce00486f","location":"mathura","
date":"2011-09-01","type":"x","msg":"How are you"}
}, {
"_index" : "mydb2",
"_type" : "mytype2",
"_id" : "1628606f4283247f269be3f8ce0086f5",
"_score" : 1.0, "_source" :
{"_rev":"4-b249916c3956d7f265119f428e982495","
author":"sarojini
naidoo","_id":"1628606f4283247f269be3f8ce0086f5","location":"h
yderabad","date":"2011-10-10","type":"x","msg":"hi how r u"}
}, {
"_index" : "mydb2",
"_type" : "mytype2",
"_id" : "1628606f4283247f269be3f8ce006335",
"_score" : 1.0, "_source" :
{"_rev":"3-6d09665e0897d108ce722a8ee9b37256","
author":"jhon","_id":"1628606f4283247f269be3f8ce006335","location":"London","dat
e":"2011-06-05","type":"x","msg":"hello london"}
}, {
"_index" : "mydb2",
"_type" : "mytype2",
"_id" : "1628606f4283247f269be3f8ce005863",
"_score" : 1.0, "_source" :
{"_rev":"4-ee087f9aec48f57d3aec7e8f33097425","
author":"washington","_id":"1628606f4283247f269be3f8ce005863","location":"NYK","
date":"2011-09-04","type":"x","msg":"fine city"}
}, {
"_index" : "mydb2",
"_type" : "mytype2",
"_id" : "1628606f4283247f269be3f8ce009380",
"_score" : 1.0, "_source" :
{"_rev":"3-94981d7b9a9c8c651e6e7be82bb3cc55","
author":"Dr. Harivans Rai
Bachchan","_id":"1628606f4283247f269be3f8ce009380","lo
cation":"pratapgarh","date":"2011-04-06","type":"x","msg":"largest producer
of a
wla in india"}
}, {
"_index" : "mydb2",
"_type" : "mytype2",
"_id" : "1628606f4283247f269be3f8ce008a27",
"_score" : 1.0, "_source" :
{"_rev":"3-bc018d2f34386c7eed59e9833711c224","
author":"sohan lal
dwedi","_id":"1628606f4283247f269be3f8ce008a27","location":"G
haziabad","date":"2011-05-07","type":"x","msg":"hi GZB"}
}, {
"_index" : "mydb2",
"_type" : "mytype2",
"_id" : "1628606f4283247f269be3f8ce006630",
"_score" : 1.0, "_source" :
{"_rev":"3-a0d0d5064862047843577b3909b2b5e4","
author":"smaller
country","_id":"1628606f4283247f269be3f8ce006630","location":"c
uba","date":"2011-09-07","type":"x","msg":"hi cubian"}
}, {
"_index" : "mydb2",
"_type" : "mytype2",
"_id" : "1628606f4283247f269be3f8ce007102",
"_score" : 1.0, "_source" :
{"_rev":"4-88656c9daa4e4ed4dd993b03c8f732e3","
author":"tim Bernar
lee","_id":"1628606f4283247f269be3f8ce007102","location":"So
uth frica","date":"2011-10-07","type":"x","msg":"hi africa"}
} ]
}
}here
----------curl: (3) [globbing] nested braces not supported at pos
8----------------------this part is showing "here place" which not should be
in result
please sir check it
thanks.
On Thu, Jun 30, 2011 at 4:11 PM, Clinton Gormley clinton@iannounce.co.ukwrote:
Sir It is working properlly but when add facet as-
OK! Progress!
'{
"query":{
"constant_score" : {
"filter" : {"or":[{
"range" : {
"date" : {
"to" : "2011-09-10",
"from" : "2011-09-01"
}
},"facet":{"range":{"date":{"to":"2011-10-17","from":"2011-10-07"}}}
}]
}}}}'
it is producing error.
First: format your JSON nicely:
{
"query" : {
"constant_score" : {
"filter" : {
"or" : [
{
"range" : {
"date" : {
"to" : "2011-09-10",
"from" : "2011-09-01"
}
},
"facet" : {
"range" : {
"date" : {
"to" : "2011-10-17",
"from" : "2011-10-07"
}
}
}
}
]
}
}
}
}
Second, look at the facets documentation and see if you have added the
facets in the right place (or for that matter, used the right keywords!)
The docs are your friends.