Skip to content

Removed the product check for client API < 8 #231

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

Merged
merged 3 commits into from
Dec 14, 2023
Merged

Conversation

ezimuel
Copy link
Contributor

@ezimuel ezimuel commented Mar 8, 2023

This PR should solve #227 removing the x-elastic-product check for API version < 8.

@@ -64,6 +65,9 @@ sub new {
$plugin_class->_init_plugin($params);
}

# Get major version of client API
$Search::Elasticsearch::API_VERSION = substr($params->{client}->{api_version}, 0, index($params->{client}->{api_version}, '_'));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of a global variable for this seems suboptimal, as it's an attribute specific to the client being used for this object. This would get overwritten every time a different version of the client is constructed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, even if this apply only if you have multiple instances of the client. I need to find a way to access the API version of the client from process_response() in Search::Elasticsearch::Role::Cxn. I'm looking into it.

@ezimuel
Copy link
Contributor Author

ezimuel commented Mar 10, 2023

@Grinnz Apart from the improvement that you suggested, did you try the fix? Thanks.

@stuartskelton
Copy link

stuartskelton commented Sep 6, 2023

@ezimuel I have tested this and it works. I currently only work with multiple ES clusters with the same version (7.10.0) so the Global does not affect me.

I have rolled back to v7.717 so I can avoid this issue.

@Grinnz do you have any other feed back?

@ezimuel
Copy link
Contributor Author

ezimuel commented Sep 28, 2023

@stuartskelton thanks for the feedback. I will try merge this asap and have a release in place.

@ezimuel
Copy link
Contributor Author

ezimuel commented Oct 18, 2023

@Grinnz I finally proposed a solution that avoids using global variable. I created a client_version read only property inside Cxn class during the BUILDARGS. Let me know what do you think, thanks!

@Grinnz
Copy link

Grinnz commented Oct 18, 2023

Looks reasonable to me. I will try it out soon

@stuartskelton
Copy link

same here it looks reasonable to me.

1 similar comment
@stuartskelton
Copy link

same here it looks reasonable to me.

@Grinnz
Copy link

Grinnz commented Dec 1, 2023

I've tested Search-Elasticsearch-8.00 with this patch with elasticsearch server 6.8.23 and everything looks good.

@ezimuel ezimuel merged commit f29a889 into master Dec 14, 2023
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