Closed zapatista closed 12 years ago
This means adding some of your documents in your bulk requests is failing. There are different reasons for that.
You should make a try catch block around the bulk request call and catch Elastica_Exception_BulkResponse. Than you can use getFailures on the exception object to get more information on which documents failed, which probably gives you more details to find the "invalid" documents.
Hi,
I am having the same error when I try lo initialize elastica bundle using: php app/console foq:elastica:populate
After a thousand or so, I get:
[Elastica_Exception_BulkResponse]
Error in one or more bulk request actions
Should I do the same? If so, where is the bulk request? in elasEtica source code?
Thanks
Hi
I assume you are using addDocuments somewhere. You should create a try / catch block around it (as described above).
I closed this as I didn't get any message back in the last two days. So I assume it worked. If not, please reopen the issue.
Hi,
I'm facing the same problem while i'm adding parent mapping I'm using
php Stack trace is
#0 /dir/to/src/vendor/elastica/lib/Elastica/Client.php(212): Elastica_Client->bulk(Array)
#1 /dir/to/src/vendor/elastica/lib/Elastica/Index.php(114): Elastica_Client->addDocuments(Array)
#2 /dir/to/src/vendor/elastica/lib/Elastica/Type.php(115): Elastica_Index->addDocuments(Array)
#3 /dir/to/src/vendor/bundles/FOQ/ElasticaBundle/Persister/ObjectPersister.php(94): Elastica_Type->addDocuments(Array)
#4 /dir/to/src/vendor/bundles/FOQ/ElasticaBundle/Doctrine/AbstractProvider.php(45): FOQ\ElasticaBundle\Persister\ObjectPersister->insertMany(Array)
#5 /dir/to/src/vendor/bundles/FOQ/ElasticaBundle/Command/PopulateCommand.php(105): FOQ\ElasticaBundle\Doctrine\AbstractProvider->populate(Object(Closure))
#6 /dir/to/src/vendor/bundles/FOQ/ElasticaBundle/Command/PopulateCommand.php(79): FOQ\ElasticaBundle\Command\PopulateCommand->populateIndex(Object(Symfony\Component\Console\Output\ConsoleOutput), 'doctors_index', true)
java stack trace is
[2012-12-16 11:24:06,272][DEBUG][action.bulk ] [Aardwolf] [doctors_index][2] failed to execute bulk item (index) index {[doctors_index][instituteServices][96], source[_na_]}
org.elasticsearch.ElasticSearchParseException: Failed to derive xcontent from (offset=483, length=2): [99, 116, 111, 114, 115, 95, 105, 110, 100, 101, 120, 34, 44, 34, 95, 112, 97, 114, 101, 110, 116, 34, 58, 53, 55, 125, 125, 10, 91, 93, 10, 123, 34, 105, 110, 100, 101....
@ruflin Can you help me on this?
This seems to be a problem of elasticsearch or the way you add the content. Elasticsearch does not seem to be able to define the content type: https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/common/xcontent/XContentFactory.java
Can you please post the code you use to add content?
@kimchy Perhaps you can help here?
This was also posted here. @thujeevan Please do not double post in the future.
https://groups.google.com/forum/?fromgroups=#!topic/elastica-php-client/UBncytAS3mM
Thanks @ruflin for your consideration, Actually i'm using foqelastica bundle to configure indexes in the config.yml. I tried to configure the parent type mapping, the code is
instituteServices:
mappings:
institution: { _parent: { type: "institutions" } }
persistence:
driver: orm
model: My\Bundle\entity\class
provider:
Here the model class is a joining table of two different entities. This may be the reason for the problem since the elasticsearch does not support many to many cardinality, but i'm not sure. The actual mapping i supposed to configure was
mappings:
institution: { _parent: { type: "institutions" } }
staff: { _parent: { type: "staffs" } }
Can you point out me a way to break out M:M other than denormalizing the tables?
As elasticsearch is in a way a document store, I would not think too much of denormalization. The goal of a search engine is to find your data as fast and as simple as possible. So it can also happen, that you store the same data twice in a different (preprocessed) format optimized for retrieval.
What are your queries going to look like? This is going to define, how you store the data. One option is to store all data twice.
when I try it, i receive this error
Message: Error in one or more bulk request actions