0
我正在使用ES php庫。這是我已經嘗試過...ElasticSearch索引文檔在現有索引上失敗
$params = [
'index' => 'tasks',
'body' => [
'settings' => [
'number_of_shards' => 3,
'number_of_replicas' => 2
],
'mappings' => [
'all' => [
'_source' => [
'enabled' => true
],
'properties' => [
'task' => [
'type' => 'string',
'analyzer' => 'standard'
],
'to' => [
'type' => 'string',
'analyzer' => 'standard'
],
'category' => [
'type' => 'integer',
'analyzer' => 'keyword'
]
]
]
]
]
];
// Create the index with mappings and settings now
$response = $client->indices()->create($params);
它返回成功。
現在,當我試圖索引文檔...
$params = [
'index' => 'tasks',
'type' => 'all',
'id' => 'some_id',
'body' => [ 'task' => 'some test', 'to' => 'name', 'category' => 1]
];
$response = $client->index($params);
這將引發錯誤和不工作,但它的工作原理,如果我嘗試這種無需先創建索引和映射。
請建議。謝謝
如果我從類別中刪除分析器,仍然會出現相同的錯誤。 – seoppc