Elastica icon indicating copy to clipboard operation
Elastica copied to clipboard

Error to Create Index, Settings, Analysis

Open EliuFlorez opened this issue 5 years ago • 1 comments

Hi guys I have an error trying to create index with your settings and analysis.

Can indexes be created from Elastica or cannot and do I have to do it from console? JSON: { "settings": { "index": { "number_of_shards": 2, "number_of_replicas": 1 }, "analysis": { "analyzer": { "categoryIdAnalyzer": { "type": "custom", "tokenizer": "whitespace" }, "std_lang": { "type": "standard", "stopwords": "_english_" } }, "filter": [] } }, ...

Code `// Create Index $elasticaIndex->create([], true);

// Settings Index if (isset($indexMapping['settings']['index'])) { $elasticaIndex->setSettings($indexMapping['settings']['index']); }

// Settings Analysis if (isset($indexMapping['settings']['analysis'])) { $elasticaIndex->analyze($indexMapping['settings']['analysis']); }

// Define mapping $mapping = new Mapping($indexMapping['mappings']['properties']);

// Response if ($response = $elasticaIndex->setMapping($mapping)) { print('CreateIndex-Success: '.$value. PHP_EOL); $return = !$response->hasError(); } else { print('CreateIndex-Error: '.$value. PHP_EOL); $logger = $this->container->get("logger"); $logger->critical("Elasticsearch Index Creation Failed.");
}`

EliuFlorez avatar Jan 07 '20 15:01 EliuFlorez

You can create indices from Elastica. Could you share in detail what the part is you couldn't create?

ruflin avatar Jan 09 '20 08:01 ruflin