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

Initial implementation of index template support #917

Closed

Conversation

dbalabka
Copy link
Contributor

@dbalabka dbalabka commented Aug 5, 2015

TODO:

  • Cover unit tests
  • Clean code

Original tiket: #916

@dbalabka dbalabka force-pushed the index-templates-support branch 2 times, most recently from 7f5361e to c8bdc50 Compare August 5, 2015 16:07
@dbalabka dbalabka changed the title Initial implementation of index template support #916 Initial implementation of index template support Aug 25, 2015
… Added possibility to remove all template indexes
# Conflicts:
#	Tests/DependencyInjection/ConfigurationTest.php
#	Tests/Index/MappingBuilderTest.php
#	Tests/Index/ResetterTest.php
#	composer.json
@oleg-andreyev
Copy link
Contributor

ping

@dbalabka
Copy link
Contributor Author

@olegandreyev I need to review PR, because it may still need some fixes
before merge
On Пт, 10 июня 2016 г. at 15:18, Oleg Andreyev notifications@github.com
wrote:

ping


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#917 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABNefO9afmD68dOajFCXezUCS58nS0x4ks5qKVYhgaJpZM4FmKLr
.

Best Regards,
Dmitrijs Balabka
Software Architect

E-Mail: dmitry.balabka@gmail.com
Cell Phone: +371 29671519
Web: http://dmitry.balabka.com/

@oleg-andreyev
Copy link
Contributor

oleg-andreyev commented Jul 15, 2016

@torinaki, I need this changes for one of my projects, let's work together on finish this up.
What left?

@dbalabka
Copy link
Contributor Author

Ok. I will review changes on weekend. If I remember correctly there is only
one issue that make almost impossible to merge these changes into master
that we need latest Ruflin's library as requirement. We can check that
IndexTemplate class exists otherwise throw Exception that Ruflin library
must be updated.
Another issue is may be related to default behavior of CLI option that if I
remember correctly was changed. It may be unexpected for other users.
On Пт, 15 июля 2016 г. at 22:49, Oleg Andreyev notifications@github.com
wrote:

@torinaki https://github.com/torinaki, I need to changes for one of my
projects, let's work together on finish this up.
What left?


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#917 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABNefCX-c-sof-qzyesb6LYRn8UDN5Pqks5qV-RhgaJpZM4FmKLr
.

Best Regards,
Dmitrijs Balabka
Software Architect

E-Mail: dmitry.balabka@gmail.com
Cell Phone: +371 29671519
Web: http://dmitry.balabka.com/

@Adirelle
Copy link

"We can check that IndexTemplate class exists otherwise throw Exception that Ruflin library must be updated."

@torinaki The right way to do this would be changing the dependencies in composer.json.

@oleg-andreyev
Copy link
Contributor

afaik IndexTemplates exists in ruflin:~3, so we'll have change dependency
to it.

On Jul 16, 2016 7:39 PM, "Adirelle" notifications@github.com wrote:

"We can check that IndexTemplate class exists otherwise throw Exception
that Ruflin library must be updated."

@torinaki https://github.com/torinaki The right way to do this would be
changing the dependencies in composer.json.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#917 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABL70FBVAlgcPfLO6t11SlhEhnuwaEz3ks5qWQlSgaJpZM4FmKLr
.

@dbalabka
Copy link
Contributor Author

@Adirelle current requirement is ruflin/elastica:~2.1. My concerns is that we need ~3.0 only to support index templates. It isn't so popular feature. Unfortunatly ruflin/elastica doesn't have supported 2.1 branch to backported this feature to 2.1.
It is easiest solution, but it may be resason why this PR may not be merged. But I will try.
// cc @oleg-andreyev

@oleg-andreyev
Copy link
Contributor

How about enabling support of IndexTemplates only with it exists in
ruflin/elastica? This way bundle can still support ruflin/elastica:~2.1,
without throwing any exceptions

On Jul 17, 2016 22:54, "Dmitry Balabka" notifications@github.com wrote:

@Adirelle https://github.com/Adirelle current requirement is
ruflin/elastica:~2.1. My concerns is that we need ~3.0 only to support
index templates. It isn't so popular feature. Unfortunatly ruflin/elastica
doesn't have supported 2.1 branch to backported this feature to 2.1.
It is easiest solution, but it may be resason why this PR may not be
merged. But I will try.
// cc @oleg-andreyev https://github.com/oleg-andreyev


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#917 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABL70L-2d76eeE4R37IKL4KF0UwqYdFoks5qWohzgaJpZM4FmKLr
.

@dbalabka
Copy link
Contributor Author

@oleg-andreyev do you really think that I'm planning to throw exception when ruflin/elastica is outdated?! 😄
Of course exception should be throwen only in case when developer trying to use index templates, but there are no such feature in ruflin/elastica

@oleg-andreyev
Copy link
Contributor

No, I was thinking about unset index_template, in Extension, if class
IndexTemplate doesn't exist and log/trigger message :)

On Jul 17, 2016 23:03, "Dmitry Balabka" notifications@github.com wrote:

@oleg-andreyev https://github.com/oleg-andreyev do you really think
that I'm planning to throw exception when ruflin/elastica is outdated?! 😄
Of course exception should be throwen only in case when developer trying
to use index templates, but there are no such feature in ruflin/elastica


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#917 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABL70OgyXZLP2GAobAOLY0xrvvIwJMXWks5qWoqqgaJpZM4FmKLr
.

@XWB
Copy link
Member

XWB commented Mar 6, 2017

Closing as this PR was never finished.

@XWB XWB closed this Mar 6, 2017
@dbalabka
Copy link
Contributor Author

@oleg-andreyev looks need to actualize. Do we still use our fork?

@buehler
Copy link

buehler commented Jun 14, 2017

Hey Guys!
I'm wondering, is this implemented now or not? I just had a usecase for index templates and I'm wondering if I can use it in the elastica.yml file or not.

Cheers

@dbalabka
Copy link
Contributor Author

@buehler we are using this on production. Because of lack of time we still using old version of bundle, but planning to upgrade soon, so we will move this PR forward ASAP.

Answering on your question, yes you can configure templates in YAML configuration files:

    index_templates:
        <name>:
            client: default
            template_name: <template name>
            template: some_index_*
            settings:
                number_of_shards: 1
                number_of_replicas: 0
            types:
                auto_suggest:
                    mappings:
                        <field name>:  <params>
                         ...

To apply templates changes we have created additional options for fos:elastica:reset command:

  • --index-template - index template to reset. If no index template name specified than all templates will be reset
  • --delete-template-indexes - will delete all indexes that matches index templates patterns. Aware that pattern may match various indexes.

You must run following command to sync templates configuration on ES server with YAML configurations:

php bin/console fos:elastica:reset --index-template

You can build-in this command into deployment process to automate template configuration sync.

@dbalabka dbalabka mentioned this pull request Dec 14, 2017
4 tasks
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

5 participants