Skip to content

Commit

Permalink
fix: correct json extension for sample ecommerce data
Browse files Browse the repository at this point in the history
Signed-off-by: hainenber <dotronghai96@gmail.com>
  • Loading branch information
hainenber committed Sep 22, 2024
1 parent d91e281 commit 02c993c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions _getting-started/ingest-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,32 @@ Use the following steps to create a sample index and define field mappings for t
```
{% include copy.html %}

1. Download [ecommerce.json](https://github.com/opensearch-project/documentation-website/blob/{{site.opensearch_major_minor_version}}/assets/examples/ecommerce.json). This file contains the index data formatted so that it can be ingested by the Bulk API:
1. Download [ecommerce.ndjson](https://github.com/opensearch-project/documentation-website/blob/{{site.opensearch_major_minor_version}}/assets/examples/ecommerce.ndjson). This file contains the index data formatted so that it can be ingested by the Bulk API:

To use cURL, send the following request:

```bash
curl -O https://github.com/raw/opensearch-project/documentation-website/{{site.opensearch_major_minor_version}}/assets/examples/ecommerce.json
curl -O https://github.com/raw/opensearch-project/documentation-website/{{site.opensearch_major_minor_version}}/assets/examples/ecommerce.ndjson
```
{% include copy.html %}

To use wget, send the following request:

```
wget https://github.com/raw/opensearch-project/documentation-website/{{site.opensearch_major_minor_version}}/assets/examples/ecommerce.json
wget https://github.com/raw/opensearch-project/documentation-website/{{site.opensearch_major_minor_version}}/assets/examples/ecommerce.ndjson
```
{% include copy.html %}

1. Define the field mappings provided in the mapping file:
```bash
curl -H "Content-Type: application/x-ndjson" -X PUT "https://localhost:9200/ecommerce" -ku admin:<custom-admin-password> --data-binary "@ecommerce-field_mappings.json"
curl -H "Content-Type: application/json" -X PUT "https://localhost:9200/ecommerce" -ku admin:<custom-admin-password> --data-binary "@ecommerce-field_mappings.json"
```
{% include copy.html %}

1. Upload the documents using the Bulk API:

```bash
curl -H "Content-Type: application/x-ndjson" -X PUT "https://localhost:9200/ecommerce/_bulk" -ku admin:<custom-admin-password> --data-binary "@ecommerce.json"
curl -H "Content-Type: application/x-ndjson" -X PUT "https://localhost:9200/ecommerce/_bulk" -ku admin:<custom-admin-password> --data-binary "@ecommerce.ndjson"
```
{% include copy.html %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ This section can be broken down into two parts:
{% include copy.html %}
1. Next, download the bulk data that you will ingest into this index:
```bash
wget https://github.com/raw/opensearch-project/documentation-website/main/assets/examples/ecommerce.json
wget https://github.com/raw/opensearch-project/documentation-website/main/assets/examples/ecommerce.ndjson
```
{% include copy.html %}
1. Use the [Create index]({{site.url}}{{site.baseurl}}/api-reference/index-apis/create-index/) API to create an index using the mappings defined in `ecommerce-field_mappings.json`:
```bash
curl -H "Content-Type: application/x-ndjson" \
curl -H "Content-Type: application/json" \
-X PUT "https://localhost:9201/ecommerce?pretty" \
--data-binary "@ecommerce-field_mappings.json" \
-ku admin:<custom-admin-password>
Expand All @@ -188,11 +188,11 @@ This section can be broken down into two parts:
"index" : "ecommerce"
}
```
1. Use the [Bulk]({{site.url}}{{site.baseurl}}/api-reference/document-apis/bulk/) API to add data to the new ecommerce index from `ecommerce.json`:
1. Use the [Bulk]({{site.url}}{{site.baseurl}}/api-reference/document-apis/bulk/) API to add data to the new ecommerce index from `ecommerce.ndjson`:
```bash
curl -H "Content-Type: application/x-ndjson" \
-X PUT "https://localhost:9201/ecommerce/_bulk?pretty" \
--data-binary "@ecommerce.json" \
--data-binary "@ecommerce.ndjson" \
-ku admin:<custom-admin-password>
```
{% include copy.html %}
Expand Down
File renamed without changes.

0 comments on commit 02c993c

Please sign in to comment.