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 more examples to the documentation #2139

Open
MalfuncEddie opened this issue Jan 24, 2023 · 2 comments
Open

Add more examples to the documentation #2139

MalfuncEddie opened this issue Jan 24, 2023 · 2 comments

Comments

@MalfuncEddie
Copy link

Currently the examples are very limited and mostly limited to search examples. The documentation should be improved to add examples for:
elasticsearch.client.IndicesClient.put_mapping
https://elasticsearch-py.readthedocs.io/en/latest/api.html?highlight=mapping#elasticsearch.client.IndicesClient.put_mapping
https://elasticsearch-py.readthedocs.io/en/master/api.html?highlight=watcher#elasticsearch.client.WatcherClient

Background: just updated my ES 7 to 8 and the python client scripts I had no longer work. After several hours plowing through the documentation I just gave up

@ezimuel
Copy link
Contributor

ezimuel commented Feb 14, 2023

@MalfuncEddie we will consider to improve the documentation. Do you have any proposal for a use case?
Moreover, can you share an error log for the issue that you found moving from ES 7 to 8? Did you check the Migrating to 8.0 documentation page?

@MalfuncEddie
Copy link
Author

I think even most of de documentation could be automated. The thing is you have a great example at the beginning how to connect to ES and I think that the same examples could be needed elsewhere.

simple examples like:

from elasticsearch import Elasticsearch
import json

es =  Elasticsearch(
    "http://localhost:9200",
    api_key=("id", "api_key")
)

if es.ping():
    print('Yay Connect')
else:
    print('Awww it could not connect!')
	
role = "rolename"
roles = ["user"]
rules = {"field" : { "username" : "*" }}'
json_rules = json.loads (rules)
es.security.put_role_mapping(name=role, enabled=enabled,roles=roles, rules=json_rules)
es.close()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants