-
Notifications
You must be signed in to change notification settings - Fork 183
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
[CCI] Create document lifecycle guide #364
[CCI] Create document lifecycle guide #364
Conversation
Signed-off-by: Alexei Karikov <[email protected]>
Signed-off-by: Alexei Karikov <[email protected]>
Hello @Nicksqain, please merge all the commits into a single commit. Thanks. |
|
||
```python | ||
from opensearchpy import OpenSearch | ||
client = OpenSearch(hosts=['http://localhost:9200']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest something like client = OpenSearch( hosts=['https://admin:admin@localhost:9200'], verify_certs=False )
. include verify_certs=False
You can also create a new document with an auto-generated ID by omitting the `id` parameter. The following code creates documents with an auto-generated IDs in the `movies` index: | ||
|
||
```python | ||
print(client.create(index=index, body={'title': 'The Lion King 2', 'year': 1998})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nicksqain, correct me if I am wrong. I am getting OpenSearch.create() missing 1 required positional argument: 'id'
error by executing the above code using opensearch 2.2.0
|
||
```python | ||
print(client.create(index=index, body={'title': 'The Lion King 2', 'year': 1998})) | ||
# OR client.index(index=index, body={"title": "The Lion King 2", "year": 1998}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commented code worked.
@Nicksqain want to finish this? Let's also add a working sample to samples. |
@dblock Yes, I'll be sure to add the necessary changes on a free day! |
Superseded with #559. |
Description
Issues Resolved
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.