Reputation: 544
I'm scratching my head over the following Elasticsearch problem:
GET /myindex/mytype/_search
with the following body:
{
"query": {
"bool": {
"should": [
{
"prefix": {
"name": "attorneys"
}
},
{
"multi_match": {
"query": "attorneys",
"type": "most_fields",
"fields": [
"name^2",
"description"
]
}
},
{
"nested": {
"boost": 2.0,
"path": "categories",
"score_mode": "sum",
"query": {
"bool": {
"should": [
{
"match": {
"categories.name": {
"fuzziness": 10,
"query": "attorneys"
}
}
},
{
"term": {
"categories.name": "attorneys"
}
}
]
// ...closing brackets trimmed for conciseness
doesn't return the document with with ID=10007.
However, GET /myindex/mytype/10007/_explain
with exactly the same query body returns:
{
"_index": "vendors",
"_type": "vendor",
"_id": "10007",
"matched": true,
"explanation": {
"value": 0.26991397,
"description": "product of:",
"details": [
{
"value": 0.8097419,
"description": "sum of:",
"details": [
{
"value": 0.8097419,
"description": "Score based on child doc range from 304 to 304"
}
]
},
{
"value": 0.33333334,
"description": "coord(1/3)"
}
]
}
}
Why would _explain
return "matched": true
but _query
not return the
document?
Upvotes: 0
Views: 55
Reputation: 217254
How many total results does your query match? Since you don't specify from/size, the default is to return the first 10 results. Maybe the document 10007 comes later than that.
Upvotes: 1