Closed designermonkey closed 9 years ago
Argh. Is it throwing an exception or just returning different results?
Each tagged version will first get an updated Changelog showing the changes in that release, so you can see the changes here: https://github.com/elasticsearch/elasticsearch-php/blob/v1.3.0/CHANGELOG.md
Edit: It looks like my changelog script broke and didn't link the actual git commits :(
Argh here too! I've made composer restrict the version to 1.2.2
and the error is still there!
I don't know what's happened here then, here's the error in case you have any insight:
Details
Type: Elasticsearch\Common\Exceptions\ServerErrorResponseException
Code: 500
Message: {"error":"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[rPiW-u8OTQy-XGfVHAzURw][testing][0]: AggregationExecutionException[[nested] nested path [handle] not found]}{[rPiW-u8OTQy-XGfVHAzURw][testing][1]: AggregationExecutionException[[nested] nested path [handle] not found]}{[rPiW-u8OTQy-XGfVHAzURw][testing][4]: AggregationExecutionException[[nested] nested path [handle] not found]}{[rPiW-u8OTQy-XGfVHAzURw][testing][2]: AggregationExecutionException[[nested] nested path [handle] not found]}{[rPiW-u8OTQy-XGfVHAzURw][testing][3]: AggregationExecutionException[[nested] nested path [handle] not found]}]","status":500}
File: /data/sites/domain.com/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php
Line: 238
Trace
#0 /data/sites/domain.com/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(191): Elasticsearch\Connections\GuzzleConnection->process5xxError(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Exception\ServerErrorResponseException), '{"from":0,"size...')
#1 /data/sites/domain.com/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(104): Elasticsearch\Connections\GuzzleConnection->sendRequest(Object(Guzzle\Http\Message\EntityEnclosingRequest), '{"from":0,"size...')
#2 /data/sites/domain.com/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php(166): Elasticsearch\Connections\GuzzleConnection->performRequest('GET', '/testing/f...', Array, '{"from":0,"size...')
#3 /data/sites/domain.com/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php(86): Elasticsearch\Transport->performRequest('GET', '/testing/f...', Array, Array)
#4 /data/sites/domain.com/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php(1010): Elasticsearch\Endpoints\AbstractEndpoint->performRequest()
#5 /data/sites/domain.com/lib/Search/QueryTrait.php(216): Elasticsearch\Client->search(Array)
#6 /data/sites/domain.com/lib/Controllers/SearchController.php(31): Embark\Dymo\Sections\FaqsQuery->execute(true, true)
#7 [internal function]: Embark\Dymo\Controllers\SearchController->__invoke()
#8 /data/sites/domain.com/vendor/slim/slim/Slim/Route.php(462): call_user_func_array(Object(Embark\Dymo\Controllers\SearchController), Array)
#9 /data/sites/domain.com/vendor/slim/slim/Slim/Slim.php(1326): Slim\Route->dispatch()
#10 /data/sites/domain.com/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call()
#11 /data/sites/domain.com/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()
#12 /data/sites/domain.com/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()
#13 /data/sites/domain.com/vendor/slim/slim/Slim/Slim.php(1271): Slim\Middleware\PrettyExceptions->call()
#14 /data/sites/domain.com/htdocs/app.php(72): Slim\Slim->run()
#15 /data/sites/domain.com/htdocs/index.php(37): include('/data/sites/dym...')
#16 {main}
Could you paste the aggregation in that query? Looks like there is something about the syntax that ES doesn't like.
What version of ES are you running? Did it get upgraded as well?
Our ES is on a separate machine that I haven't touched upgraded recently. I'll try and get it to output the query now.
Here's the JSON
{
"from": 0,
"size": 1000,
"query": {
"bool": {
"must": [{
"match_all": []
}, {
"match_all": []
}]
}
},
"aggregations": {
"lists": {
"global": {},
"aggregations": {
"handle": {
"filter": {
"match_all": []
},
"aggregations": {
"documents": {
"nested": {
"path": "handle"
},
"aggregations": {
"fields": {
"terms": {
"field": "handle",
"size": 100
},
"aggregations": {
"field-value": {
"terms": {
"field": "handle"
}
}
}
}
}
}
}
},
"is-on-home": {
"filter": {
"match_all": []
},
"aggregations": {
"documents": {
"nested": {
"path": "is-on-home"
},
"aggregations": {
"fields": {
"terms": {
"field": "is-on-home",
"size": 100
},
"aggregations": {
"field-value": {
"terms": {
"field": "is-on-home"
}
}
}
}
}
}
}
}
}
}
}
}
Ahh, I think it is complaining about this:
"nested": {
"path": "handle"
}
Is this perhaps being executed across types in an index (or across multiple indices) and one of those types doesn't have a nested mapping? That would make the aggregation spew since it can't find the nested fields.
Is that the fully qualified path? E.g. if the doc is:
{
"name" : "foo",
"location" : {
"address" : "123"
}
}
The fully qualified path would be location.address
.
If you want to share a sample doc + mappings, I can take a look locally.
It's a really simple mapping really, all properties are strings at one level deep, so
{
"title": "My String Value",
"handle": "my-string-value"
}
Oh, in that case you don't need the nested
bucket at all. That's only used for accessing data in nested documents, since it would be otherwise inaccessible to the aggregation.
You should be able to remove the nested
portion, eg:
{
"from": 0,
"size": 1000,
"query": {
"bool": {
"must": [{
"match_all": []
}, {
"match_all": []
}]
}
},
"aggregations": {
"lists": {
"global": {},
"aggregations": {
"handle": {
"filter": {
"match_all": []
},
"aggregations": {
"fields": {
"terms": {
"field": "handle",
"size": 100
},
"aggregations": {
"field-value": {
"terms": {
"field": "handle"
}
}
}
}
}
},
"is-on-home": {
"filter": {
"match_all": []
},
"aggregations": {
"fields": {
"terms": {
"field": "is-on-home",
"size": 100
},
"aggregations": {
"field-value": {
"terms": {
"field": "is-on-home"
}
}
}
}
}
}
}
}
}
}
You might need to do some renaming, since this removed the documents
level from the aggregation
Ah, I think this is because we're using the same code to generate aggs for different structures. I'll give that a shot then.
It seems you are right! It was as I said about different mappings and the same code.
Thanks again for being so helpful :)
No problem! Happy it was a (relatively) easy fix :)
Hi there. Are there any release notes to show changes between, specifically, version 1.2.2 and 1.3.0? Composer updated this on one of our systems, and a project now fails with only one search out of 5 (meaning we're looking for different things in different searches).