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

[CCI] Create document lifecycle guide #364

Closed

Conversation

Nicksqain
Copy link
Contributor

@Nicksqain Nicksqain commented Apr 8, 2023

Description

  • Create document lifecycle guide

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.

Signed-off-by: Alexei Karikov <[email protected]>
Signed-off-by: Alexei Karikov <[email protected]>
@saimedhi
Copy link
Collaborator

saimedhi commented Jun 5, 2023

Hello @Nicksqain, please merge all the commits into a single commit. Thanks.


```python
from opensearchpy import OpenSearch
client = OpenSearch(hosts=['http://localhost:9200'])
Copy link
Collaborator

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}))
Copy link
Collaborator

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})
Copy link
Collaborator

Choose a reason for hiding this comment

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

The commented code worked.

@dblock
Copy link
Member

dblock commented Jul 26, 2023

@Nicksqain want to finish this? Let's also add a working sample to samples.

@Nicksqain
Copy link
Contributor Author

@dblock Yes, I'll be sure to add the necessary changes on a free day!

@dblock
Copy link
Member

dblock commented Nov 9, 2023

Superseded with #559.

@dblock dblock closed this Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Guide] Document Lifecycle
4 participants