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

elasticsearch create index meta error using php client #324

Closed
sintret opened this issue Aug 31, 2014 · 1 comment
Closed

elasticsearch create index meta error using php client #324

sintret opened this issue Aug 31, 2014 · 1 comment

Comments

@sintret
Copy link

sintret commented Aug 31, 2014

I am using elasticsearch for php client and this plugin. how to write "index" and "type" using php;
i have code like this :
$params['index'] = '_river';
$params['type'] = 'my_jdbc_river';
$params['body'] = [
'mapping' => [
'type' => 'jdbc',
'jdbc' => [
'url' => 'jdbc:mysql://localhost:3306/tourexplora',
"user" => "root",
"password" => "",
"sql" => "select *, id as _id from cities",
"index" => "teindex9",
"type" => "cities",
"bulk_size" => 500
]
]
];

    $ret = $this->client->indices()->create($params);

but errors shown like this:
exception 'Elasticsearch\Common\Exceptions\UnexpectedValueException' with
message 'type is not a valid parameter' in
D:\xampp\htdocs\tourexplora\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Endpoints\AbstractEndpoint.php:263
Stack trace:
#0

D:\xampp\htdocs\tourexplora\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Endpoints\AbstractEndpoint.php(239):
Elasticsearch\Endpoints\AbstractEndpoint->ifParamsInvalidThrowException(Array)
#1

D:\xampp\htdocs\tourexplora\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Endpoints\AbstractEndpoint.php(115):
Elasticsearch\Endpoints\AbstractEndpoint->checkUserParams(Array)
#2

D:\xampp\htdocs\tourexplora\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Namespaces\IndicesNamespace.php(838):
Elasticsearch\Endpoints\AbstractEndpoint->setParams(Array)
#3

D:\xampp\htdocs\tourexplora\protected\controllers\ElasticsearchController.php(164):
Elasticsearch\Namespaces\IndicesNamespace->create(Array)
#4

D:\xampp\htdocs\tourexplora\yii\framework114\web\actions\CInlineAction.php(49):
ElasticsearchController->actionCreateRiver()
#5 D:\xampp\htdocs\tourexplora\yii\framework114\web\CController.php(308):

CInlineAction->runWithParams(Array)
#6 D:\xampp\htdocs\tourexplora\yii\framework114\web\CController.php(286):

CController->runAction(Object(CInlineAction))
#7 D:\xampp\htdocs\tourexplora\yii\framework114\web\CController.php(265):

CController->runActionWithFilters(Object(CInlineAction), Array)
#8

D:\xampp\htdocs\tourexplora\yii\framework114\web\CWebApplication.php(282):
CController->run('createRiver')
#9

D:\xampp\htdocs\tourexplora\yii\framework114\web\CWebApplication.php(141):
CWebApplication->runController('elasticsearch/c...')
#10

@jprante
Copy link
Owner

jprante commented Aug 31, 2014

The command is wrong. Do not use 'mapping' => [ ... ] There is no mapping. You must use HTTP PUT on the _meta endpoint. See the README.md

I can not find any example of river creation in official PHP client so I believe it is not supported.

@jprante jprante closed this as completed Oct 19, 2014
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