Skip to content

Add index creating from existing index - #17

Open
volynvlad wants to merge 8 commits into
cr7258:mainfrom
volynvlad:create-index-copy
Open

Add index creating from existing index#17
volynvlad wants to merge 8 commits into
cr7258:mainfrom
volynvlad:create-index-copy

Conversation

@volynvlad

@volynvlad volynvlad commented Apr 2, 2025

Copy link
Copy Markdown
Contributor
  • Merged with main
  • Add method: create_index_copy(index: str, existing_index: str) -> list[TextContent] for IndexTools
  • Add methods: get_settings, get_mappings for IndexClient class
  • Add ruff. Format code
  • Fix error: SearchClientBase is an abstract base class, but it has no abstract methods or properties

@cr7258

cr7258 commented Apr 3, 2025

Copy link
Copy Markdown
Owner

Hi @volynvlad, Thanks for your contribution.
Could you please resolve the code conflicts? I did some refactoring yesterday.

Comment thread src/exceptions.py
Comment on lines +1 to +12
__all__ = [
"UnsupportedEngineException",
]


class UnsupportedEngineException(Exception):
def __init__(self, message: str) -> None:
self.message = message
super().__init__(self.message)

def __str__(self) -> str:
return self.message

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

How about merging src/clients/exceptions.py and src/exceptions.py into one file?

Comment thread src/server.py Outdated
Comment thread src/server.py
Comment on lines -52 to -58
def elasticsearch_mcp_server():
"""Entry point for Elasticsearch MCP server."""
run_search_server(engine_type="elasticsearch")

def opensearch_mcp_server():
"""Entry point for OpenSearch MCP server."""
run_search_server(engine_type="opensearch")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

We need to keep the elasticsearch_mcp_server and opensearch_mcp_server functions because they are defined as the entry point in the pyproject.toml.

User can use uv run elasticsearch-mcp-server or uv run opensearch-mcp-server to start the mcp server.

Comment thread src/tools/index.py Outdated
Comment thread src/tools/index.py Outdated
Comment thread .env.example
Comment thread src/tools/index.py
return self.search_client.create_index(index=index, body=body)

@mcp.tool(description="Create new index with the same mapping as existing_index")
def create_index_copy(index: str, existing_index: str) -> list[TextContent]:

@cr7258 cr7258 Apr 10, 2025

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Could you please update this new tool create_index_copy in the README?
https://github.com/cr7258/elasticsearch-mcp-server?tab=readme-ov-file#index-operations

volynvlad and others added 4 commits April 10, 2025 19:55
Co-authored-by: Se7en <chengzw258@163.com>
Co-authored-by: Se7en <chengzw258@163.com>
Co-authored-by: Se7en <chengzw258@163.com>
Co-authored-by: Se7en <chengzw258@163.com>
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.

2 participants