Search_query

Sandeep,

The docs are working for me at:

The first problem is that your query isn't valid JSON (a JSON object
can't have two properties with the same name).
Try indenting it clearly so you can see the JSON error, then refer to
the docs for the correct query syntax.

Cheers,
Chris

On Wed, Jun 29, 2011 at 5:50 PM, sandeep tiwari sandeep15mca@gmail.com wrote:

On Fri, Jun 24, 2011 at 4:30 PM, Clinton Gormley clinton@iannounce.co.uk
wrote:

On Fri, 2011-06-24 at 16:05 +0530, sandeep tiwari wrote:

Sir!
After executing the query there is some exception please check
query-

Sandeep - please read the docs. your syntax error is pretty obvious.

Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic

Sir!
I try to open docs on Elasticsearch Platform — Find real-time answers at scale | Elastic but its give 404
code error while speed is to good I request to you please guide me where
syntax error in-
curl -XGET 'http://127.0.0.1:9200/mydb2/mytype2/_search?pretty=true' -d '
'{
"filtered":{
"query":{
"constant_score" : {
"filter" : {"and":[{
"range" : {
"date" : {
"lte" : "2011-09-01",
"gte" : "2011-09-10"
}
}
}],
"and":[{"range" : {
"date" : {
"lte" : "2011-10-07",
"gte" : "2011-10-17"
}
}
}]
}
}
}
}
}'
because is is generated exception.
thanks

clint

Sir!
My problem is that to find out details of between two different dates
-for which we apply query which I have send u previous request please send
me query which fulfill my requirements.
because last three days I have been my best but couldn't got success.

                                      thanks.

On Wed, Jun 29, 2011 at 3:41 PM, Chris Berkhout chrisberkhout@gmail.comwrote:

Sandeep,

The docs are working for me at:
Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic

The first problem is that your query isn't valid JSON (a JSON object
can't have two properties with the same name).
Try indenting it clearly so you can see the JSON error, then refer to
the docs for the correct query syntax.

Cheers,
Chris

On Wed, Jun 29, 2011 at 5:50 PM, sandeep tiwari sandeep15mca@gmail.com
wrote:

On Fri, Jun 24, 2011 at 4:30 PM, Clinton Gormley <
clinton@iannounce.co.uk>
wrote:

On Fri, 2011-06-24 at 16:05 +0530, sandeep tiwari wrote:

Sir!
After executing the query there is some exception please check
query-

Sandeep - please read the docs. your syntax error is pretty obvious.

Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic

Sir!
I try to open docs on Elasticsearch Platform — Find real-time answers at scale | Elastic but its give
404
code error while speed is to good I request to you please guide me where
syntax error in-
curl -XGET 'http://127.0.0.1:9200/mydb2/mytype2/_search?pretty=true' -d
'
'{
"filtered":{
"query":{
"constant_score" : {
"filter" : {"and":[{
"range" : {
"date" : {
"lte" : "2011-09-01",
"gte" : "2011-09-10"
}
}
}],
"and":[{"range" : {
"date" : {
"lte" : "2011-10-07",
"gte" : "2011-10-17"
}
}
}]
}
}
}
}
}'
because is is generated exception.
thanks

clint

Sir!
I am facing a problem regarding previous query which I have send
yesterday and
I want to apply facet in that query for find the valuable result my
query is bellow which is not work properly-
$ curl -XGET 'http://192.168.1.100:9200/mydb2/mytype2/_search?pretty=true'
-d
'{
"filtered":{
"query":{
"constant_score" : {
"filter" : {"or":[{
"range" : {
"date" : {
"lte" : "2011-09-01",
"gte" : "2011-09-10"

          }

},"facet":{"range":{"date":{"lte":2011-10-17"","gte":2011-10-07""}}}

    }]
 }
}
}'

On Wed, Jun 29, 2011 at 6:42 PM, sandeep tiwari sandeep15mca@gmail.comwrote:

Sir!
My problem is that to find out details of between two different dates
-for which we apply query which I have send u previous request please send
me query which fulfill my requirements.
because last three days I have been my best but couldn't got success.

                                      thanks.

On Wed, Jun 29, 2011 at 3:41 PM, Chris Berkhout chrisberkhout@gmail.comwrote:

Sandeep,

The docs are working for me at:
Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic

The first problem is that your query isn't valid JSON (a JSON object
can't have two properties with the same name).
Try indenting it clearly so you can see the JSON error, then refer to
the docs for the correct query syntax.

Cheers,
Chris

On Wed, Jun 29, 2011 at 5:50 PM, sandeep tiwari sandeep15mca@gmail.com
wrote:

On Fri, Jun 24, 2011 at 4:30 PM, Clinton Gormley <
clinton@iannounce.co.uk>
wrote:

On Fri, 2011-06-24 at 16:05 +0530, sandeep tiwari wrote:

Sir!
After executing the query there is some exception please check
query-

Sandeep - please read the docs. your syntax error is pretty obvious.

Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic

Sir!
I try to open docs on Elasticsearch Platform — Find real-time answers at scale | Elastic but its give
404
code error while speed is to good I request to you please guide me where
syntax error in-
curl -XGET 'http://127.0.0.1:9200/mydb2/mytype2/_search?pretty=true'
-d '
'{
"filtered":{
"query":{
"constant_score" : {
"filter" : {"and":[{
"range" : {
"date" : {
"lte" : "2011-09-01",
"gte" : "2011-09-10"
}
}
}],
"and":[{"range" : {
"date" : {
"lte" : "2011-10-07",
"gte" : "2011-10-17"
}
}
}]
}
}
}
}
}'
because is is generated exception.
thanks

clint

Sir!
I am facing a problem regarding previous query which I have send
yesterday and
I want to apply facet in that query for find the valuable result my
query is bellow which is not work properly-
$ curl -XGET 'http://192.168.1.100:9200/mydb2/mytype2/_search?pretty=true'
-d
'{
"filtered":{
"query":{
"constant_score" : {
"filter" : {"or":[{
"range" : {
"date" : {
"lte" : "2011-09-01",
"gte" : "2011-09-10"

          }

},"facet":{"range":{"date":{"lte":2011-10-17"","gte":2011-10-07""}}}

    }]
 }
}

}'
and another problem is that docs is nnot open give authentication
error.please help me

                                                       thanks

On Wed, Jun 22, 2011 at 3:02 PM, Lukáš Vlček lukas.vlcek@gmail.com wrote:

Hi,

can you give some example of the output you want to get from the search
engine?

Regards,
Lukas

On Wed, Jun 22, 2011 at 11:13 AM, sandeep tiwari sandeep15mca@gmail.comwrote:

Sir!
I want to know how use group by date in my Elasticsearch query.

On Wed, Jun 22, 2011 at 2:39 PM, Lukáš Vlček lukas.vlcek@gmail.comwrote:

Hi,

On Wed, Jun 22, 2011 at 10:39 AM, sandeep tiwari <sandeep15mca@gmail.com

wrote:

Hi!
if anybody have been used groupby query in Elasticsearch.Please
reply me.

                                                    Your Thankfully

                                                  Sandeep Kumar Tiwari

I suggest you parse your JSon documents before sending them to ES
"facet":{"range":{"date":{"lte":2011-10-17"","gte":2011-10-07""}}}

should be something like
"facet":{"range":{"date":{"lte":"2011-10-17","gte":"2011-10-07"}}}

You can use the great mobz EShead project : https://github.com/mobz/elasticsearch-head

David.

Sir!
After execute bellow query follwing exception/error comes out,My
excpected result is -
yyyy-mm-dd-all information
yyyy-mm-dd-allinformation
till last date please help me ASAP.
$ curl -XGET 'http://192.168.1.100:9200/mydb2/mytype2/_search?pretty=true'
-d
'{
"filtered":{
"query":{
"constant_score" : {
"filter" : {"or":[{
"range" : {
"date" : {
"lte" : "2011-09-10",
"gte" : "2011-09-01"

          }

},"facet":{"range":{"date":{"lte":2011-10-17","gte":"2011-10-07"}}}
}]
}
}
}'
{
"error" : "SearchPhaseExecutionException[Failed to execute phase [query],
tota
l failure; shardFailures {[JLoAsYWIQvS87JhMKhBr5Q][mydb2][0]:
SearchParseExcepti
on[[mydb2][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\n
"
filtered":{\n "query":{\n "constant_score" : {\n "filter"
: {
"or":[{\n "range" : {\n "date" : {\n
"lte" : "2011-09-10",\n "gte" : "2011-09-01"\n\n
}\n
},"facet":{"range":{"date":{"lte":2011-10-17","g
te":"2011-10-07"}}}\n }]\n }\n }\n }]]]; nested:
SearchParse
Exception[[mydb2][0]: from[-1],size[-1]: Parse Failure [No parser for
element [f
iltered]]]; }{[JLoAsYWIQvS87JhMKhBr5Q][mydb2][1]:
SearchParseException[[mydb2][1
]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\n
"filtered":{
\n "query":{\n "constant_score" : {\n "filter" :
{"or":[{\n
"range" : {\n "date" : {\n
"lte" :
"2011-09-10",\n "gte" : "2011-09-01"\n\n
}\n

},"facet":{"range":{"date":{"lte":2011-10-17","gte":"2011-
10-07"}}}\n }]\n }\n }\n }]]]; nested:
SearchParseException[[m
ydb2][1]: from[-1],size[-1]: Parse Failure [No parser for element
[filtered]]];
}{[JLoAsYWIQvS87JhMKhBr5Q][mydb2][2]: SearchParseException[[mydb2][2]:
from[-1],
size[-1]: Parse Failure [Failed to parse source [{\n "filtered":{\n
"query
":{\n "constant_score" : {\n "filter" : {"or":[{\n
"
range" : {\n "date" : {\n "lte" :
"2011-09-10
",\n "gte" : "2011-09-01"\n\n }\n
},
"facet":{"range":{"date":{"lte":2011-10-17","gte":"2011-10-07"}}}\n
}]\n }\n }\n }]]]; nested:
SearchParseException[[mydb2][2]: fr
om[-1],size[-1]: Parse Failure [No parser for element [filtered]]];
}{[JLoAsYWIQ
vS87JhMKhBr5Q][mydb2][3]: SearchParseException[[mydb2][3]:
from[-1],size[-1]: Pa
rse Failure [Failed to parse source [{\n "filtered":{\n "query":{\n
"
constant_score" : {\n "filter" : {"or":[{\n "range"
: {
n "date" : {\n "lte" : "2011-09-10",\n
"gte" : "2011-09-01"\n\n }\n
},"facet":{
"range":{"date":{"lte":2011-10-17","gte":"2011-10-07"}}}\n
}]\n
}\n }\n }]]]; nested: SearchParseException[[mydb2][3]:
from[-1],size[
-1]: Parse Failure [No parser for element [filtered]]];
}{[JLoAsYWIQvS87JhMKhBr5
Q][mydb2][4]: SearchParseException[[mydb2][4]: from[-1],size[-1]: Parse
Failure
[Failed to parse source [{\n "filtered":{\n "query":{\n
"constant_sco
re" : {\n "filter" : {"or":[{\n "range" : {\n
"date" : {\n "lte" : "2011-09-10",\n
"
gte" : "2011-09-01"\n\n }\n
},"facet":{"range":{"
date":{"lte":2011-10-17","gte":"2011-10-07"}}}\n }]\n }\n
}\n }]]]; nested: SearchParseException[[mydb2][4]: from[-1],size[-1]:
Parse F
ailure [No parser for element [filtered]]]; }]",
"status" : 500
}

On Thu, Jun 30, 2011 at 2:30 PM, David Pilato david@pilato.fr wrote:

I suggest you parse your JSon documents before sending them to ES
"facet":{"range":{"date":{"lte":2011-10-17"","gte":2011-10-07""}}}

should be something like
"facet":{"range":{"date":{"lte":"2011-10-17","gte":"2011-10-07"}}}

You can use the great mobz EShead project :
GitHub - mobz/elasticsearch-head: A web front end for an elastic search cluster

David.

Reading the doc here : http://www.elasticsearch.org/guide/reference/query-dsl/filtered-query.html it seems that Filtered Query is "a query that applies a filter to the results of another query."

There is no query in your search call.

Try to add a "match_all" before filtering anything.
http://www.elasticsearch.org/guide/reference/query-dsl/match-all-query.html

Sorry bad answer. Forget it !

On Thu, Jun 30, 2011 at 11:28 AM, sandeep tiwari sandeep15mca@gmail.comwrote:

},"facet":{"range":{"date":{"lte":2011-10-17","gte":"2011-10-07"}}}

You're missing the quotes .. "lte":"2011-10-17" ..

On Thu, 2011-06-30 at 11:00 +0200, David Pilato wrote:

I suggest you parse your JSon documents before sending them to ES
"facet":{"range":{"date":{"lte":2011-10-17"","gte":2011-10-07""}}}

should be something like
"facet":{"range":{"date":{"lte":"2011-10-17","gte":"2011-10-07"}}}

Actually, range facets only support to/from at the moment, not
gt/gte/lt/lte

Clint

Hi Sandeep

I want to apply facet in that query for find the valuable result

my query is bellow which is not work properly-
$ curl -XGET
'http://192.168.1.100:9200/mydb2/mytype2/_search?pretty=true' -d
'{
"filtered":{

Why do you have "filtered" on the line above?

The structure of a query is always:

http://localhost:9200/index/type/_search?pretty=true' -d '
{ query: {.....} }
'

The "query" must be at the top level. Always.

Then you have 3 choices:

  1. a query clause eg { text: { title: "john smith" }}
  2. a filter clause eg { term: {status: "active" }}
  3. a query and filter clause eg both of the above

If you have just a query, then you can add it directly:

{ query: {
text: { title: "john smith" }
}}

If you have just a filter, then you should wrap it in a constant_score
query:

{ query: {
constant_score: {
filter: {
term: { status: "active" }
}
}
}}

If you want to combine a query and a filter, then you should wrap them
in a filtered query:

{ query: {
filtered: {
query: { text: { title: "john smith" }},
filter: { term: { status: "active" }}
}
}}

clint

thanks lot Sir.......

On Thu, Jun 30, 2011 at 3:39 PM, Clinton Gormley clinton@iannounce.co.ukwrote:

Hi Sandeep

I want to apply facet in that query for find the valuable result

my query is bellow which is not work properly-
$ curl -XGET
'http://192.168.1.100:9200/mydb2/mytype2/_search?pretty=true' -d
'{
"filtered":{

Why do you have "filtered" on the line above?

The structure of a query is always:

http://localhost:9200/index/type/_search?pretty=true' -d '
{ query: {.....} }
'

The "query" must be at the top level. Always.

Then you have 3 choices:

  1. a query clause eg { text: { title: "john smith" }}
  2. a filter clause eg { term: {status: "active" }}
  3. a query and filter clause eg both of the above

If you have just a query, then you can add it directly:

{ query: {
text: { title: "john smith" }
}}

If you have just a filter, then you should wrap it in a constant_score
query:

{ query: {
constant_score: {
filter: {
term: { status: "active" }
}
}
}}

If you want to combine a query and a filter, then you should wrap them
in a filtered query:

{ query: {
filtered: {
query: { text: { title: "john smith" }},
filter: { term: { status: "active" }}
}
}}

clint

Sir!
curl -XGET '
http://192.168.1.100:9200/mydb2/mytype2/_search?pretty=true' -d
'{
"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"}}}

   }]

}}
sorry sir inconvenience but it is not working even please help me
On Thu, Jun 30, 2011 at 3:42 PM, sandeep tiwari sandeep15mca@gmail.comwrote:

thanks lot Sir.......

On Thu, Jun 30, 2011 at 3:39 PM, Clinton Gormley clinton@iannounce.co.ukwrote:

Hi Sandeep

I want to apply facet in that query for find the valuable result

my query is bellow which is not work properly-
$ curl -XGET
'http://192.168.1.100:9200/mydb2/mytype2/_search?pretty=true' -d
'{
"filtered":{

Why do you have "filtered" on the line above?

The structure of a query is always:

http://localhost:9200/index/type/_search?pretty=true' -d '
{ query: {.....} }
'

The "query" must be at the top level. Always.

Then you have 3 choices:

  1. a query clause eg { text: { title: "john smith" }}
  2. a filter clause eg { term: {status: "active" }}
  3. a query and filter clause eg both of the above

If you have just a query, then you can add it directly:

{ query: {
text: { title: "john smith" }
}}

If you have just a filter, then you should wrap it in a constant_score
query:

{ query: {
constant_score: {
filter: {
term: { status: "active" }
}
}
}}

If you want to combine a query and a filter, then you should wrap them
in a filtered query:

{ query: {
filtered: {
query: { text: { title: "john smith" }},
filter: { term: { status: "active" }}
}
}}

clint

sorry sir inconvenience but it is not working even please help me

"it is not working" is not useful

Sandeep you're really going to have to learn to understand what you're
doing. You can't just copy and paste this stuff.

Check the syntax of your query. (Clue: it is incorrect).

Break it down into small parts - get those parts working, then add
bigger parts.

clint

Thanks Sir!

On Thu, Jun 30, 2011 at 3:51 PM, sandeep tiwari sandeep15mca@gmail.comwrote:

Sir!
curl -XGET '
http://192.168.1.100:9200/mydb2/mytype2/_search?pretty=true' -d
'{
"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"}}}

   }]

}}
sorry sir inconvenience but it is not working even please help me

On Thu, Jun 30, 2011 at 3:42 PM, sandeep tiwari sandeep15mca@gmail.comwrote:

thanks lot Sir.......

On Thu, Jun 30, 2011 at 3:39 PM, Clinton Gormley <clinton@iannounce.co.uk

wrote:

Hi Sandeep

I want to apply facet in that query for find the valuable result

my query is bellow which is not work properly-
$ curl -XGET
'http://192.168.1.100:9200/mydb2/mytype2/_search?pretty=true' -d
'{
"filtered":{

Why do you have "filtered" on the line above?

The structure of a query is always:

http://localhost:9200/index/type/_search?pretty=true' -d '
{ query: {.....} }
'

The "query" must be at the top level. Always.

Then you have 3 choices:

  1. a query clause eg { text: { title: "john smith" }}
  2. a filter clause eg { term: {status: "active" }}
  3. a query and filter clause eg both of the above

If you have just a query, then you can add it directly:

{ query: {
text: { title: "john smith" }
}}

If you have just a filter, then you should wrap it in a constant_score
query:

{ query: {
constant_score: {
filter: {
term: { status: "active" }
}
}
}}

If you want to combine a query and a filter, then you should wrap them
in a filtered query:

{ query: {
filtered: {
query: { text: { title: "john smith" }},
filter: { term: { status: "active" }}
}
}}

clint

'{
"query":{
"constant_score" : {
"filter" : {"or":[{
"range" : {
"date" : {
"to" : "2011-09-10",
"from" : "2011-09-01"

         }
      }
   }]

}}}}'
Sir It is working properlly but when add facet as-
'{
"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.
please guide me.

On Thu, Jun 30, 2011 at 3:51 PM, sandeep tiwari sandeep15mca@gmail.comwrote:

Sir!
curl -XGET '
http://192.168.1.100:9200/mydb2/mytype2/_search?pretty=true' -d
'{
"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"}}}

   }]

}}
sorry sir inconvenience but it is not working even please help me

On Thu, Jun 30, 2011 at 3:42 PM, sandeep tiwari sandeep15mca@gmail.comwrote:

thanks lot Sir.......

On Thu, Jun 30, 2011 at 3:39 PM, Clinton Gormley <clinton@iannounce.co.uk

wrote:

Hi Sandeep

I want to apply facet in that query for find the valuable result

my query is bellow which is not work properly-
$ curl -XGET
'http://192.168.1.100:9200/mydb2/mytype2/_search?pretty=true' -d
'{
"filtered":{

Why do you have "filtered" on the line above?

The structure of a query is always:

http://localhost:9200/index/type/_search?pretty=true' -d '
{ query: {.....} }
'

The "query" must be at the top level. Always.

Then you have 3 choices:

  1. a query clause eg { text: { title: "john smith" }}
  2. a filter clause eg { term: {status: "active" }}
  3. a query and filter clause eg both of the above

If you have just a query, then you can add it directly:

{ query: {
text: { title: "john smith" }
}}

If you have just a filter, then you should wrap it in a constant_score
query:

{ query: {
constant_score: {
filter: {
term: { status: "active" }
}
}
}}

If you want to combine a query and a filter, then you should wrap them
in a filtered query:

{ query: {
filtered: {
query: { text: { title: "john smith" }},
filter: { term: { status: "active" }}
}
}}

clint

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.

Sir !
All Things have been done perfectlly but result is unexpected please
help me -
'{
"filtered":
{
"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.

Sorry sir result is previous is correct but query is this-

On Thu, Jun 30, 2011 at 4:52 PM, sandeep tiwari sandeep15mca@gmail.comwrote:

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.

On Thu, 2011-06-30 at 16:54 +0530, sandeep tiwari wrote:

Sorry sir result is previous is correct but query is this-

        All Things have been done perfectlly but result is
    unexpected please help me -

Sandeep - you clearly haven't read the docs. Go do so - I can't help you
if you won't help yourself.

clint