Get explain for all results returned for a query


(Srinivasan Ramaswamy) #1

Hi

I would like to get explain for top results that are returned for the
query.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-explain.html

Shows me how to get explain for a query and a given document, but i want to
explain for all (top 10 or 20 results, that i requested) the documents that
are returned. Is there any parameter i can enable to get that information ?

Thanks
Srini

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/28e409e6-b790-464b-a464-4aa65d70f3a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Binh Ly-2) #2

Yes, you can do:

curl localhost:9200/_search -d '{
"explain": true,
"query": {}
}'

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/6673d605-d13a-46b3-9307-380d0679a4f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Srinivasan Ramaswamy) #3

When I try

{
"query": {
* "explain": true,*
"function_score": {
"boost_mode": "replace",
"query": {
"match": { "design.PRODUCT_DESC":"cool"}
},
"filter": {
"range": {
"design.PRODUCT_TYPE_NO":{
"from":1,
"to":4
}
}
},
"script_score": {
"params": {
"param1": 2,
"param2": 3.1
},
"script": "_score * doc['design.CLICKS'].value / pow(param1,
param2)"
}
}
}
}

I get the error message

Caused by: org.elasticsearch.index.query.QueryParsingException: [designs]
[_na] query malformed, no field after start_object

at
org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:216)
Without the explain line the above query works. What is the real syntax for
explain along with function_score ?

Thanks
Srini

On Friday, April 4, 2014 3:20:16 PM UTC-7, Binh Ly wrote:

Yes, you can do:

curl localhost:9200/_search -d '{
"explain": true,
"query": {}
}'

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e2017fdd-0e46-4925-a252-4876907b03a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Binh Ly-2) #4

explain should be outside (same level) of query just like in my previous
example. :slight_smile:

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/5e1a3eef-5474-4cd9-b260-3c393069ed42%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Srinivasan Ramaswamy) #5

Thanks for clearing it up for me. I was under the assumption that
everything should be under the query, coz when i tried removing the outer
query (earlier without the explain and just the function score) it didnt
work.

Can you tell me what are the things that goes inside the query and what can
go outside ? I am also confused coz there are two queries, one outside to
wrap function_score and one inside to represent the actual keyword.

Thanks
Srini

On Friday, April 4, 2014 3:58:17 PM UTC-7, Binh Ly wrote:

explain should be outside (same level) of query just like in my previous
example. :slight_smile:

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2cdd8cf4-f45c-465b-b91c-e5e495571580%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #6