Skip to content
This repository has been archived by the owner on Mar 4, 2019. It is now read-only.

Using count returns an error from ElasticSearch #37

Closed
el-barto opened this issue Feb 19, 2016 · 1 comment
Closed

Using count returns an error from ElasticSearch #37

el-barto opened this issue Feb 19, 2016 · 1 comment

Comments

@el-barto
Copy link
Contributor

I'm trying to count documents from a type called ix_resources in my index called my_index. Here's a sample code:

        var_dump($this->IxResource->find('count'));

        var_dump($this->IxResource->find('count', array(
            'conditions' => array(
                'IxResource.resource_type' => 2,
            )
        )));

In both cases the printed result is 0, which is wrong. I did a little debugging of ElasticSearch's response, and I see that while the value of _count in the result is zero, I'm getting error messages likes these from every shard:

For the first query:
BroadcastShardOperationFailedException[[my_index][0] ]; nested: QueryParsingException[[my_index] request does not support [match_all]];

For the second one:
BroadcastShardOperationFailedException[[my_index][0] ]; nested: QueryParsingException[[my_index] request does not support [filtered]];

I believe it has to do with the way the query needs to be constructed for the Count API.

I think there are two things to improve here:
a) The way the count queries are built
b) Error handling, because no exception was raised in my tests.

@josegonzalez
Copy link
Owner

I'm going to guess you are using elasticsearch 2.x.

This plugin does not work under ES 2.x, nor do I use it in production anymore. Pull requests to documentation/the code are welcome to fix support for this new version, but I do not expect to continue maintaining the code otherwise. Sorry.

Please upgrade to CakePHP 3.x, where there is an officially supported ElasticSearch module.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants