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

Ability to change mapping filename #120

Merged
merged 1 commit into from
Oct 9, 2022

Conversation

insekticid
Copy link
Contributor

if using non standardized mapping file naming

//this will work
 $indexBuilder->migrate($this->elasticallyClient->getIndex($indexName), [], ['filename' => 'content_mapping.yaml']);

//this works
$index = $indexBuilder->createIndex($indexName, ['filename' => 'content_mapping.yaml']);

if using non standardized mapping file naming

```php
//this will work
 $indexBuilder->migrate($this->elasticallyClient->getIndex($indexName), [], ['filename' => 'content_mapping.yaml']);

//this works
$index = $indexBuilder->createIndex($indexName, ['filename' => 'content_mapping.yaml']);
```
@damienalexandre damienalexandre merged commit cabc799 into jolicode:master Oct 9, 2022
@damienalexandre
Copy link
Member

Thanks a lot - that was a bug indeed.

In the next major version I intend to remove this context (#115) because it's a source of confusion and error - mapping providers are going to be more robust that way.

I will release this patch very soon. Thanks!

@insekticid
Copy link
Contributor Author

@damienalexandre Ok, so think about solution, how to use same mapping file for more indexes. I have indexes with prefix content- + langName (e.g. cs, de, sk...) so I do not want to make copies of content_mapping.yaml file with the same config. Or think about extending from base mapping file and use something like

content_cs_mapping.yaml:

imports:
  - { resource: ' content_mapping.yaml' }


content_de_mapping.yaml:

imports:
  - { resource: ' content_mapping.yaml' }

@damienalexandre
Copy link
Member

Yes, thanks for the suggestion 👍

We will do our best to include this in the YamlMappingProvider, and if not possible, you always have the possibility of building your own mapping provider with the https://github.com/jolicode/elastically/blob/master/src/Mapping/MappingProviderInterface.php.

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

Successfully merging this pull request may close these issues.

None yet

2 participants