Add CONSOLE to explain
This commit is contained in:
parent
4057682d6f
commit
88c5a574a6
|
@ -11,39 +11,111 @@ type respectively.
|
||||||
[float]
|
[float]
|
||||||
=== Usage
|
=== Usage
|
||||||
|
|
||||||
|
Imagine having indexed the following document:
|
||||||
|
|
||||||
|
[source,js]
|
||||||
|
----------------------------------------
|
||||||
|
PUT /twitter/tweet/1?refresh
|
||||||
|
{
|
||||||
|
"user": "kimchy",
|
||||||
|
"message": "search"
|
||||||
|
}
|
||||||
|
---------------------------------------
|
||||||
|
// CONSOLE
|
||||||
|
// TESTSETUP
|
||||||
|
|
||||||
|
|
||||||
Full query example:
|
Full query example:
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------
|
||||||
curl -XGET 'localhost:9200/twitter/tweet/1/_explain' -d '{
|
GET /twitter/tweet/1/_explain
|
||||||
|
{
|
||||||
"query" : {
|
"query" : {
|
||||||
"term" : { "message" : "search" }
|
"term" : { "message" : "search" }
|
||||||
}
|
}
|
||||||
}'
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------
|
||||||
|
// CONSOLE
|
||||||
|
|
||||||
This will yield the following result:
|
This will yield the following result:
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
{
|
{
|
||||||
"matches" : true,
|
"_index": "twitter",
|
||||||
"explanation" : {
|
"_type": "tweet",
|
||||||
"value" : 0.15342641,
|
"_id": "1",
|
||||||
"description" : "fieldWeight(message:search in 0), product of:",
|
"matched": true,
|
||||||
"details" : [ {
|
"explanation": {
|
||||||
"value" : 1.0,
|
"value": 1.0,
|
||||||
"description" : "tf(termFreq(message:search)=1)"
|
"description": "sum of:",
|
||||||
}, {
|
"details": [
|
||||||
"value" : 0.30685282,
|
{
|
||||||
"description" : "idf(docFreq=1, maxDocs=1)"
|
"value": 1.0,
|
||||||
}, {
|
"description": "weight(message:search in 0) [PerFieldSimilarity], result of:",
|
||||||
"value" : 0.5,
|
"details": [
|
||||||
"description" : "fieldNorm(field=message, doc=0)"
|
{
|
||||||
} ]
|
"value": 1.0,
|
||||||
|
"description": "fieldWeight in 0, product of:",
|
||||||
|
"details": [
|
||||||
|
{
|
||||||
|
"value": 1.0,
|
||||||
|
"description": "tf(freq=1.0), with freq of:",
|
||||||
|
"details": [
|
||||||
|
{
|
||||||
|
"value": 1.0,
|
||||||
|
"description": "termFreq=1.0",
|
||||||
|
"details": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": 1.0,
|
||||||
|
"description": "idf(docFreq=1, docCount=1)",
|
||||||
|
"details": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": 1.0,
|
||||||
|
"description": "fieldNorm(doc=0)",
|
||||||
|
"details": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": 0.0,
|
||||||
|
"description": "match on required clause, product of:",
|
||||||
|
"details": [
|
||||||
|
{
|
||||||
|
"value": 0.0,
|
||||||
|
"description": "# clause",
|
||||||
|
"details": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": 1.0,
|
||||||
|
"description": "_type:tweet, product of:",
|
||||||
|
"details": [
|
||||||
|
{
|
||||||
|
"value": 1.0,
|
||||||
|
"description": "boost",
|
||||||
|
"details": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": 1.0,
|
||||||
|
"description": "queryNorm",
|
||||||
|
"details": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
// TESTRESPONSE
|
||||||
|
|
||||||
There is also a simpler way of specifying the query via the `q`
|
There is also a simpler way of specifying the query via the `q`
|
||||||
parameter. The specified `q` parameter value is then parsed as if the
|
parameter. The specified `q` parameter value is then parsed as if the
|
||||||
|
@ -52,8 +124,9 @@ explain api:
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
curl -XGET 'localhost:9200/twitter/tweet/1/_explain?q=message:search'
|
GET /twitter/tweet/1/_explain?q=message:search
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
// CONSOLE
|
||||||
|
|
||||||
This will yield the same result as the previous request.
|
This will yield the same result as the previous request.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue