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

Add auto Follow #325

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add auto Follow #325

wants to merge 1 commit into from

Conversation

jherns
Copy link
Contributor

@jherns jherns commented Feb 12, 2025

No description provided.

@Copilot Copilot bot review requested due to automatic review settings February 12, 2025 22:25
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This pull request adds support for auto-follow policies in cross-cluster replication. The changes include new test setups and verifications to ensure an auto-follow policy is correctly created, retrieved, and cleaned up, as well as new methods in the client for creating, deleting, and retrieving auto-follow patterns.

  • Updated tests to set up and validate auto-follow indices.
  • Added new methods in the client to interact with auto-follow patterns.
  • Updated cleanup logic in tests to remove auto-follow patterns after test execution.

Changes

File Description
test/client/ccr_test.rb Added tests for auto-follow policy, creating new indexes and cleanup logic
lib/elastomer_client/client/ccr.rb Implemented API support for creating, deleting, and retrieving auto-follow patterns

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

# See https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html

def auto_follow(pattern_name, body, params = {})
response = client.put "/_ccr/auto_follow/#{pattern_name}", params.merge(params, body:, action: "create_auto_follow_pattern", rest_api: "ccr")
Copy link
Preview

Copilot AI Feb 12, 2025

Choose a reason for hiding this comment

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

The auto_follow method calls merge on params twice, which may lead to unexpected duplication of parameters. Consider using a single merge combining the body and params, for example: params.merge(body: body, action: "create_auto_follow_pattern", rest_api: "ccr").

Suggested change
response = client.put "/_ccr/auto_follow/#{pattern_name}", params.merge(params, body:, action: "create_auto_follow_pattern", rest_api: "ccr")
response = client.put "/_ccr/auto_follow/#{pattern_name}", params.merge(body: body, action: "create_auto_follow_pattern", rest_api: "ccr")

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
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.

1 participant