Problem with explain


(puyuan001) #1

Hi all,
I'm a newbie to es, and I've got a problem when using _explain api,
this is the command I use:

curl -XGET 'localhost:9200/question_bank/questions/_explain' -d '{
"query" : {"query_string" : {
"query" : "a b c d"
}}}'

and got this result:
{"_index":"question_bank","_type":"questions","_id":"_explain","exists":false}

Thanks so much for any help:)

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Ivan Brusic) #2

The proper syntax is /{index}/{type}/{id}/_explain

You need to add the id of the document to the API call.

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java?source=cc#L58-59

--
Ivan

On Wed, Nov 13, 2013 at 8:54 PM, puyuan001@gmail.com wrote:

Hi all,
I'm a newbie to es, and I've got a problem when using _explain api,
this is the command I use:

curl -XGET 'localhost:9200/question_bank/questions/_explain' -d '{
"query" : {"query_string" : {
"query" : "a b c d"
}}}'

and got this result:

{"_index":"question_bank","_type":"questions","_id":"_explain","exists":false}

Thanks so much for any help:)

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(puyuan001) #3

thanks Ivan,
after adding the id:
curl -XGET 'localhost:9200/question_bank/questions/0/_explain' -d '{
"query" : {"query_string" : {
"query" : "a b c d"
}}}'

I got this:
{"ok":false,"_index":"question_bank","_type":"questions","_id":"0","matched":false}

I also tried search with explain option, like this:
curl -XGET 'localhost:9200/question_bank/questions/_search' -d '{
"query" : {"query_string" : {
"query" : "a b c d"
}},"explain":true}'

and I got:
{"took":234,"timed_out":false,"_shards":{"total":2,"successful":2,"failed":0},"hits":{"total":1324189,"max_score":13.550743,"hits":[{"_shard":0,"_node":"m-zznkETTn2Z5mSrCF4DzA","_index":"question_bank","_type":"questions","_id":"EEtIn8qkRKulaILawxLyVw","_score":13.550743,
"_source" : {"id":3413350,"stem_inner":" 设集合A={a,b},B={b,c,d},则A∪B=( )
A、{b}B、{b,c,d}C、{a,c,d}D、{a,b,c,d}"},"_explanation":{"value":0.0,"description":"product
of:","details":[{"value":0.0,"description":"sum
of:"},{"value":0.0,"description":"coord(0/4)"}]}},{"_shard":0,"_node":"m-zznkETTn2Z5mSrCF4DzA","_index":"question_bank","_type":"questions","_id":"Ua4UHbN_R7C4rb3m57c4OQ","_score":12.746416,
"_source" :
{"id":2496941,"stem_inner":"8.已知集合A={a,b},B={a,b,c},C={b,c,d},那么集合(A∩B)∪C等于A{a,b,c}B{a,b,d}C{b,c,d}D{a,b,c,d}"},"_explanation":{"value":0.0,"description":"product
of:","details":[{"value":0.0,"description":"sum
of:"},{"value":0.0,"description":"coord(0/4)"}]}},{"_shard":0,"_node":"m-zznkETTn2Z5mSrCF4DzA","_index":"question_bank","_type":"questions","_id":"YiqnTpRHTTKdmrMYsG0Lsg","_score":12.746416,
"_source" : {"id":3410906,"stem_inner":"
已知集合A={a,b},B={a,b,c},C={b,c,d},那么集合(A∩B)∪C等于( )
A、{a,b,c}B、{a,b,d}C、{b,c,d}D、{a,b,c,d}"},"_explanation":{"value":0.0,"description":"product
of:","details":[{"value":0.0,"description":"sum
of:"},{"value":0.0,"description":"coord(0/4)"}]}},{"_shard":0,"_node":"m-zznkETTn2Z5mSrCF4DzA","_index":"question_bank","_type":"questions","_id":"TIdSFa8hQ0-wkgOZZA7reA","_score":12.324519,
"_source" : {"id":348640,"stem_inner":"设集合A={a,b},B={b,c,d},则A∪B= [
]A.{b} B.{b,c,d} C.{a,c,d} D.{a,b,c,d}
"},"_explanation":{"value":0.0,"description":"product
of:","details":[{"value":0.0,"description":"sum
of:"},{"value":0.0,"description":"coord(0/4)"}]}},{"_shard":1,"_node":"4ZIK6-O-SvyD4BSNYrZL0g","_index":"question_bank","_type":"questions","_id":"BMlUOGJ9T1egOdR2IgpOOA","_score":12.191338,
"_source" : {"id":326247,"stem_inner":"设,,,则[ ]A、a<b<c B、c<b<a C、c<a<b
D、b<a<c "},"_explanation":{"value":0.0,"description":"product
of:","details":[{"value":0.0,"description":"sum
of:"},{"value":0.0,"description":"coord(0/4)"}]}},{"_shard":0,"_node":"m-zznkETTn2Z5mSrCF4DzA","_index":"question_bank","_type":"questions","_id":"tZyT7YLXQNS3b8CT9cqm_A","_score":12.18048,
"_source" : {"id":484715,"stem_inner":"设,,,则[ ]A、a<b<c B、c<b<a C、c<a<b
D、b<a<c "},"_explanation":{"value":0.0,"description":"product
of:","details":[{"value":0.0,"description":"sum
of:"},{"value":0.0,"description":"coord(0/4)"}]}},{"_shard":0,"_node":"m-zznkETTn2Z5mSrCF4DzA","_index":"question_bank","_type":"questions","_id":"5ReZjgkDR4y6pEirHwLQsQ","_score":12.18048,
"_source" : {"id":486184,"stem_inner":"若,则 [ ]A、a<b<c B、c<b<a C、c<a<b
D、b<a<c "},"_explanation":{"value":0.0,"description":"product
of:","details":[{"value":0.0,"description":"sum
of:"},{"value":0.0,"description":"coord(0/4)"}]}},{"_shard":1,"_node":"4ZIK6-O-SvyD4BSNYrZL0g","_index":"question_bank","_type":"questions","_id":"fWcTQJelRpqHOKeDiwITDg","_score":12.084454,
"_source" : {"id":321858,"stem_inner":"若a=-0.42,b=-4-2,c=,则a、b、c、d的大小关系为[
]A、a<b<c<d B、b<a<d<c C、a<d<c<b D、c<a<d<b
"},"_explanation":{"value":0.0,"description":"product
of:","details":[{"value":0.0,"description":"sum
of:"},{"value":0.0,"description":"coord(0/4)"}]}},{"_shard":1,"_node":"4ZIK6-O-SvyD4BSNYrZL0g","_index":"question_bank","_type":"questions","_id":"u5egHX5FRVKPfeWHzNduxQ","_score":11.856148,
"_source" : {"id":3522849,"stem_inner":"图中A,B,C,D四地,属于背斜构造的是( )A、A
B、B C、C
D、D"},"_explanation":{"value":0.0,"description":"product
of:","details":[{"value":0.0,"description":"sum
of:"},{"value":0.0,"description":"coord(0/4)"}]}},{"_shard":0,"_node":"m-zznkETTn2Z5mSrCF4DzA","_index":"question_bank","_type":"questions","_id":"Gqj4krlpSfyG2T2Jqw1R7A","_score":11.841712,
"_source" :
{"id":2691009,"stem_inner":"已知集合A={a,b},B={a,b,c},C={b,c,d},那么集合(A∩B)∪C等于(
)A.{a,b,c}B.{a,b,d}C.{b,c,d}D.{a,b,c,d}"},"_explanation":{"value":0.0,"description":"product
of:","details":[{"value":0.0,"description":"sum
of:"},{"value":0.0,"description":"coord(0/4)"}]}}]}}

在 2013年11月14日星期四UTC+8下午2时25分48秒,Ivan Brusic写道:

The proper syntax is /{index}/{type}/{id}/_explain

You need to add the id of the document to the API call.

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java?source=cc#L58-59

--
Ivan

On Wed, Nov 13, 2013 at 8:54 PM, <puyu...@gmail.com <javascript:>> wrote:

Hi all,
I'm a newbie to es, and I've got a problem when using _explain api,
this is the command I use:

curl -XGET 'localhost:9200/question_bank/questions/_explain' -d '{
"query" : {"query_string" : {
"query" : "a b c d"
}}}'

and got this result:

{"_index":"question_bank","_type":"questions","_id":"_explain","exists":false}

Thanks so much for any help:)

--
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 elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4