我试图将一系列文档编入索引到ElasticSearch。
510对象被正确索引(来自ElasticHQ),但(至少)一个导致400错误请求错误。这是完整的堆栈跟踪:
exception 'Guzzle\Http\Exception\ClientErrorResponseException' with message 'Client error response
[status code] 400
[reason phrase] Bad Request
[url] http://localhost:9200/vins/vin/1465' in /Users/nicolaswidart/Sites/Mestdagh_2/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php:43
Stack trace:
#0 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/guzzle/guzzle/src/Guzzle/Http/Message/Request.php(145): Guzzle\Http\Exception\BadResponseException::factory(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Message\Response))
#1 [internal function]: Guzzle\Http\Message\Request::onRequestError(Object(Guzzle\Common\Event), 'request.error', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#2 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(164): call_user_func(Array, Object(Guzzle\Common\Event), 'request.error', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#3 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(53): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'request.error', Object(Guzzle\Common\Event))
#4 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/guzzle/guzzle/src/Guzzle/Http/Message/Request.php(589): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('request.error', Object(Guzzle\Common\Event))
#5 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/guzzle/guzzle/src/Guzzle/Http/Message/Request.php(378): Guzzle\Http\Message\Request->processResponse(Array)
#6 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/guzzle/guzzle/src/Guzzle/Http/Message/EntityEnclosingRequest.php(49): Guzzle\Http\Message\Request->setState('complete', Array)
#7 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(290): Guzzle\Http\Message\EntityEnclosingRequest->setState('complete', Array)
#8 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(248): Guzzle\Http\Curl\CurlMulti->processResponse(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Curl\CurlHandle), Array)
#9 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(231): Guzzle\Http\Curl\CurlMulti->processMessages()
#10 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(215): Guzzle\Http\Curl\CurlMulti->executeHandles()
#11 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(109): Guzzle\Http\Curl\CurlMulti->perform()
#12 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMultiProxy.php(94): Guzzle\Http\Curl\CurlMulti->send()
#13 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/guzzle/guzzle/src/Guzzle/Http/Client.php(284): Guzzle\Http\Curl\CurlMultiProxy->send()
#14 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/guzzle/guzzle/src/Guzzle/Http/Message/Request.php(198): Guzzle\Http\Client->send(Object(Guzzle\Http\Message\EntityEnclosingRequest))
#15 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(162): Guzzle\Http\Message\Request->send()
#16 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(98): Elasticsearch\Connections\GuzzleConnection->sendRequest(Object(Guzzle\Http\Message\EntityEnclosingRequest), false)
#17 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php(162): Elasticsearch\Connections\GuzzleConnection->performRequest('PUT', '/vins/vin/1465', Array, false)
#18 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php(86): Elasticsearch\Transport->performRequest('PUT', '/vins/vin/1465', Array, Array)
#19 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php(857): Elasticsearch\Endpoints\AbstractEndpoint->performRequest()
#20 /Users/nicolaswidart/Sites/Mestdagh_2/modules/elasticsearch/classes/Indexers/VinIndexer.php(70): Elasticsearch\Client->index(Array)
#21 /Users/nicolaswidart/Sites/Mestdagh_2/modules/elasticsearch/controllers/ControlElasticsearchService.php(16): VinIndexer->indexOne('1465')
#22 [internal function]: ControlElasticsearchService->indexOne('1465')
#23 /Users/nicolaswidart/Sites/Mestdagh_2/core/application/module/controller/Controller.php(410): call_user_func(Array, '1465')
#24 /Users/nicolaswidart/Sites/Mestdagh_2/core/application/Application.php(170): Controller->run(Array, false)
#25 /Users/nicolaswidart/Sites/Mestdagh_2/core/application/Application.php(136): Application->startMainController()
#26 /Users/nicolaswidart/Sites/Mestdagh_2/index.php(87): Application->run()
#27 {main}
Next exception 'Elasticsearch\Common\Exceptions\BadRequest400Exception' with message '{"error":"MapperParsingException[failed to parse, document is empty]","status":400}' in /Users/nicolaswidart/Sites/Mestdagh_2/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php:239
Stack trace:
#0 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(167): Elasticsearch\Connections\GuzzleConnection->process4xxError(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Exception\ClientErrorResponseException), false)
#1 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(98): Elasticsearch\Connections\GuzzleConnection->sendRequest(Object(Guzzle\Http\Message\EntityEnclosingRequest), false)
#2 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php(162): Elasticsearch\Connections\GuzzleConnection->performRequest('PUT', '/vins/vin/1465', Array, false)
#3 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php(86): Elasticsearch\Transport->performRequest('PUT', '/vins/vin/1465', Array, Array)
#4 /Users/nicolaswidart/Sites/Mestdagh_2/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php(857): Elasticsearch\Endpoints\AbstractEndpoint->performRequest()
#5 /Users/nicolaswidart/Sites/Mestdagh_2/modules/elasticsearch/classes/Indexers/VinIndexer.php(70): Elasticsearch\Client->index(Array)
#6 /Users/nicolaswidart/Sites/Mestdagh_2/modules/elasticsearch/controllers/ControlElasticsearchService.php(16): VinIndexer->indexOne('1465')
#7 [internal function]: ControlElasticsearchService->indexOne('1465')
#8 /Users/nicolaswidart/Sites/Mestdagh_2/core/application/module/controller/Controller.php(410): call_user_func(Array, '1465')
#9 /Users/nicolaswidart/Sites/Mestdagh_2/core/application/Application.php(170): Controller->run(Array, false)
#10 /Users/nicolaswidart/Sites/Mestdagh_2/core/application/Application.php(136): Application->startMainController()
#11 /Users/nicolaswidart/Sites/Mestdagh_2/index.php(87): Application->run()
#12 {main}
它说文件是空的,但它不是...... 这是我试图索引的对象,导致该错误:
array (size=2)
'body' =>
array (size=29)
'sNameLngFr' => string 'Pinot Blanc D'alsace Stã©phane Berg' (length=37)
'pPrix' => float 4.99
'iPromotion' => int 0
'pPromotion' => float 4.99
'sColor' => string 'blancsec' (length=8)
'sColorLngFr' => string 'Blanc Sec' (length=9)
'sColorLngNl' => string 'Droge witte wijn' (length=16)
'sProducerUrl' => string '' (length=0)
'iVintage' => int 2012
'sPackageType' => string '6bouteilles' (length=11)
'sPackageTypeLngFr' => string '6 bouteilles' (length=12)
'sPackageTypeLngNl' => string '6 flessen' (length=9)
'sKeepingPotentialLngFr' => string '2015' (length=4)
'sKeepingPotentialLngNl' => string '' (length=0)
'sVolume' => string '75cl' (length=4)
'pays' =>
array (size=3)
'iPays' => int 10
'sNameLngFr' => string 'France' (length=6)
'sNameLngNl' => string 'Frankrijk' (length=9)
'region' =>
array (size=3)
'iRegion' => int 29
'sNameLngFr' => string 'Alsace' (length=6)
'sNameLngNl' => string 'Alsace' (length=6)
'appellation' =>
array (size=3)
'iAppelation' => int 49
'sNameLngFr' => string 'Alsace Pinot ou Klevner' (length=23)
'sNameLngNl' => string 'Alsace Pinot ou Klevner' (length=23)
'sProducer' => string 'S. BERG ORSCHWILLER' (length=19)
'iKeepingPotential' => int 0
'sCommentaireLngFr' => string '' (length=0)
'sCommentaireLngNl' => string '' (length=0)
'sExternalRef' => string '718182' (length=6)
'sFood1' => string '13' (length=2)
'sFood2' => string '8' (length=1)
'sFood3' => string '3' (length=1)
'sEanBarcode' => string '' (length=0)
'iFamilyId' => int 71
'sFullExternalRef' => string '00718182' (length=8)
'id' => int 1465
当对索引的510个文档进行随机搜索时,我得到:
array (size=3)
'total' => int 61
'max_score' => float 0.99237627
'hits' =>
array (size=10)
0 =>
array (size=5)
'_index' => string 'vins' (length=4)
'_type' => string 'vin' (length=3)
'_id' => string '938' (length=3)
'_score' => float 0.99237627
'_source' =>
array (size=29)
'sNameLngFr' => string 'Chateau Vieux Ligat' (length=19)
'pPrix' => float 5.89
'iPromotion' => int 0
'pPromotion' => float 5.89
'sColor' => string 'rougefruité' (length=12)
'sColorLngFr' => string 'Rouge Fruité' (length=13)
'sColorLngNl' => string 'Fruitige rode wijn' (length=18)
'sProducerUrl' => string '' (length=0)
'iVintage' => int 2010
'sPackageType' => string '6bouteilles' (length=11)
'sPackageTypeLngFr' => string '6 bouteilles' (length=12)
'sPackageTypeLngNl' => string '6 flessen' (length=9)
'sKeepingPotentialLngFr' => string '2015' (length=4)
'sKeepingPotentialLngNl' => string '' (length=0)
'sVolume' => string '75 cl' (length=5)
'pays' =>
array (size=3)
'iPays' => int 10
'sNameLngFr' => string 'France' (length=6)
'sNameLngNl' => string 'Frankrijk' (length=9)
'region' =>
array (size=3)
'iRegion' => int 31
'sNameLngFr' => string 'Bordeaux' (length=8)
'sNameLngNl' => string 'Bordeaux' (length=8)
'appellation' =>
array (size=3)
'iAppelation' => int 71
'sNameLngFr' => string 'Bordeau' (length=7)
'sNameLngNl' => string 'Bordeau' (length=7)
'sProducer' => string 'SERGE SEGUIN' (length=12)
'iKeepingPotential' => int 0
'sCommentaireLngFr' => string '<p dir="LTR">Un vin rouge aux belles notes de fruits rouges. Fin et délicat, il accompagnera viandes rouges et fromages</p>' (length=124)
'sCommentaireLngNl' => string '<p>Een rode wijn met rode vruchtenaroma's. Fijn en delikaat, perfect met rood vlees en kaas.</p>' (length=96)
'sExternalRef' => string '711290' (length=6)
'sFood1' => string '3' (length=1)
'sFood2' => string '4' (length=1)
'sFood3' => string '6' (length=1)
'sEanBarcode' => string '9990259121902' (length=13)
'iFamilyId' => int 71
'sFullExternalRef' => string '00711290' (length=8)
1 =>
如图所示,某些属性为空,索引正常。
出现此错误的原因是什么?在那个特定的对象上?
感谢。
答案 0 :(得分:2)
string 'Pinot Blanc D'alsace
'<p>Een rode wijn met rode vruchtenaroma's. Fijn en delikaat, perfect met rood vlees en kaas.</p>'
这两行有一个禁用的字符,试图逃避它们,它可能会起作用。