question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[PROPOSAL] Plugins Python Client Interface

See original GitHub issue

What kind of business use case are you trying to solve? What are your requirements?

Although the current state of opensearch-py can connect to opensearch database and do transactions seamlessly, To use plugins features like Search Plugin or Monitoring Plugin, one needs to follow the REST guideline from docs and need to make the requests and the workflow manually. I, right now have a personal requirement of the alerting feature from the Monitoring Plugin to be implemented in a pythonic way.

What is the problem? What is preventing you from meeting the requirements? The problem is the lack of python support for the plugins as most of the organizations using the python client would probably use monitoring and other plugin features as well. Lack of this particular feature would mean, one needs to use opensearch-py in one hand and also using the REST API from the docs on the other hand, creating a mixed feeling in the developers heart, unhealthy code and probably some security flaws in the developer’s code as well.

What are you proposing? What do you suggest we do to solve the problem or improve the existing situation? I am proposing a pythonic implementation of the plugins API, which would look something like this:


from opensearchpy import OpenSearch
from opensearchpy.plugins.alerting import Monitors, MonitorType, Trigger

client = OpenSearch(...)

# To Get Monitor from it's ID
client.plugins.alerting.get_monitor('X9umLn0B5FPOmJ6VSaWe')

# To Create a new Monitor
query = {...}
client.plugins.alerting.create_monitor(query)

# To get all Destinations
client.plugins.alerting.get_destination()

...

What are your assumptions or prerequisites? N/A

What are remaining open questions? List questions that may need to be answered before proceeding with an implementation.

  • Is this feature contextual to this particular project or is it more contextual to opensearch-dsl-py or should someone make a different project to interface the plugins?
  • Assuming that this proposal is contextual to either this project or the dsl one, what kind of directory structure should I proceed with. Should I add a directory named contrib or plugins ?
  • Should I go for as much pythonic way I can or should I ask most of the input arguments as Dictionary?
  • Any coding convention that I should be following ?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:7
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
stockholmuxcommented, Mar 28, 2022

@gabrielcocenza The API is the way to do it right now. OpenSearch follows SemVer so the concern of the APIs breaking will only be an issue at a major versions. I would think the charm you’re developing would need to change at that time anyway.

Also, the ES client’s CCR is similar in name only - I don’t believe that theres is compatibility between the OpenSearch and ES implementations of CCR.

All this being said, I agree though, yes, going forward it would be nice to have CCR abstracted into the library 😃

1reaction
axeomancommented, Dec 3, 2021

Yea, I agree that this is a useful feature and thanks a lot for that 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Building a proposal for an (official) high level python API
My proposal would be building a mostly thin abstraction layer over the low level api to provide: a stable interface for plugins ......
Read more >
Creating and discovering plugins
Often when creating a Python application or library you'll want the ability to provide customizations or extra features via plugins. Because Python packages...
Read more >
OEP-12: Pluggable User Interfaces - Open edX Proposals
This can be used by client-side logic to fetch a fragment and then dynamically render it into the current page. There are already...
Read more >
proposal/L58-python-async-api.md at master · grpc ... - GitHub
Python doesn't have a Future interface in its standard library. In the absence of such a standard, three separate, incompatible implementations (concurrent.
Read more >
Proposal of a Python interface to OpenMI, as the base for ...
Leading GIS desktop applications – GRASS and QGIS – use Python as second native language, providing well documented API. This way, a Python- ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found