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

fix(metadata): check if elasticsearch is set to false by user through ApiResource (#5115) #5177

Merged

Conversation

jannes-io
Copy link
Contributor

@jannes-io jannes-io commented Nov 9, 2022

Q A
Branch? 3.0
Tickets #5115
License MIT
Doc PR api-platform/docs#1648

If elasticsearch is set to false by the user forcefully on the ApiResource attribute, then don't bother fetching the index anyway. This just causes needless slowdowns during container build.

I would've liked to revert the logic, in other words, only do the hasIndices check if elasticsearch: true, but that would introduce a BC break, so after this change, projects using a mix of orm & elasticsearch entities can simply mark their orm entities with elasticsearch: false and their elasticsearch entities with elasticsearch: true, and the index discovery will only be done on those with elasticsearch: true.

Not a big deal if your application is small, but once you start getting into triple digits of entities, doing a request for every single entity causes major slowdowns when APP_ENV is not set to prod (when the operations aren't cached).

@jannes-io jannes-io force-pushed the elasticsearch-metadata-resource-provider branch from 70acc9e to 356362d Compare November 9, 2022 18:55
@jannes-io jannes-io marked this pull request as ready for review November 9, 2022 19:08
@soyuka
Copy link
Member

soyuka commented Nov 9, 2022

nice, you can even target the 3.0 branch as its a bug fix.

side note: we're working on improvements for Elasticsearch on 3.1!

@kdckrs
Copy link

kdckrs commented Nov 10, 2022

nice, you can even target the 3.0 branch as its a bug fix.

side note: we're working on improvements for Elasticsearch on 3.1!

Awesome! Would be epic to get this PR merged as it boosts performance instantly!

@jannes-io
Copy link
Contributor Author

nice, you can even target the 3.0 branch as its a bug fix.

side note: we're working on improvements for Elasticsearch on 3.1!

Will do.

@jannes-io jannes-io marked this pull request as draft November 10, 2022 08:10
@jannes-io jannes-io changed the base branch from main to 3.0 November 10, 2022 08:10
@jannes-io jannes-io marked this pull request as ready for review November 10, 2022 08:12
@jannes-io
Copy link
Contributor Author

@soyuka moved to 3.0

jannes-io added a commit to jannes-io/docs that referenced this pull request Nov 10, 2022
Add documentation to the elasticsearch property to reflect behavior added in api-platform/core#5177
@soyuka soyuka merged commit dbf4447 into api-platform:3.0 Nov 10, 2022
@soyuka
Copy link
Member

soyuka commented Nov 10, 2022

thanks !

@jannes-io jannes-io deleted the elasticsearch-metadata-resource-provider branch November 10, 2022 08:26
@kdckrs
Copy link

kdckrs commented Nov 10, 2022

Epic guys, thanks for the flawless improvements and speed of merge!

alanpoulain pushed a commit to api-platform/docs that referenced this pull request Nov 10, 2022
Add documentation to the elasticsearch property to reflect behavior added in api-platform/core#5177
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.

3 participants