Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MsearchTemplate endpoint implementation #599

Closed
arconen opened this issue Jul 7, 2017 · 5 comments
Closed

MsearchTemplate endpoint implementation #599

arconen opened this issue Jul 7, 2017 · 5 comments

Comments

@arconen
Copy link
Contributor

arconen commented Jul 7, 2017

MsearchTemplate endpoint implementation

/_msearch/template is a beautiful and useful feature in Elasticsearch 5.x, and I have no idea why this endpoint isn't implemented yet here.

@polyfractal
Copy link
Contributor

++ Looks like it was just an oversight. I'll try to add it soon :)

polyfractal added a commit that referenced this issue Jul 19, 2017
@arconen
Copy link
Contributor Author

arconen commented Jul 21, 2017

I've got an error when I was trying to call msearchTemplate method

$request = [
	'body' => [
		[
                    'index' => 'base'
                ],
                [
                    'file' => 'basetmpl',
                    'params' => [
			'baselist' => [
                        	'baseid' => [
                            		['value' => 1],
                            		['value' => 2, 'isLast' => true]
                        	]
                    	]
		    ]
                ],
                [
                    'index' => 'target'
                ],
                [
                    'file' => 'targettmpl',
                    'params' => [
			'targetlist' => [
                        	'targetid' => [
                            		['value' => 11],
                            		['value' => 12, 'isLast' => true]
                        	]
                    	]
		    ]
                ]
	]
];
$result = $this->client->msearchTemplate($request);

Too few arguments to function Elasticsearch\Endpoints\MsearchTemplate::__construct(), 0 passed in .../vendor/elasticsearch/elasticsearch/src/Elasticsearch/ClientBuilder.php on line 531 and exactly 1 expected

Seems you forgot to change one line in ClientBuilder.
ClientBuilder.php#L512

                if ($class === 'Bulk' || $class === 'Msearch' || $class === 'MPercolate') {
                    return new $fullPath($serializer);
                } else {
                    return new $fullPath();
                }

should be

                if ($class === 'Bulk' || $class === 'Msearch' || $class === 'MsearchTemplate' || $class === 'MPercolate') {
                    return new $fullPath($serializer);
                } else {
                    return new $fullPath();
                }

Am I right?

@polyfractal
Copy link
Contributor

Argh, yep, you're right. Wanna send a PR?

If not, I'll take care of this tomorrow. Sorry about that!

This was referenced Jul 21, 2017
@arconen
Copy link
Contributor Author

arconen commented Aug 7, 2017

@polyfractal I've sent two PR as you mentioned above, but they are still open. Something wrong?

@polyfractal
Copy link
Contributor

I'm just bad, that's all :( Sorry for the delay, been very busy around here. Merged! Thanks again

p365labs pushed a commit to p365labs/elasticsearch-php that referenced this issue Sep 10, 2017
p365labs pushed a commit to p365labs/elasticsearch-php that referenced this issue Sep 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants