Link Search Menu Expand Document Documentation Menu

Ingest your data into Lucenia

There are several ways to ingest data into Lucenia:

Bulk indexing

To index documents in bulk, you can use the Bulk API. For example, if you want to index several documents into the students index, send the following request:

POST _bulk
{ "create": { "_index": "students", "_id": "2" } }
{ "name": "Jonathan Powers", "gpa": 3.85, "grad_year": 2025 }
{ "create": { "_index": "students", "_id": "3" } }
{ "name": "Jane Doe", "gpa": 3.52, "grad_year": 2024 }

Experiment with sample data

Lucenia provides a fictitious e-commerce dataset that you can use to experiment with REST API requests and OpenSearch Dashboards visualizations. You can create an index and define field mappings by downloading the corresponding dataset and mapping files.

Create a sample index

Use the following steps to create a sample index and define field mappings for the document fields:

  1. Download ecommerce-field_mappings.json. This file defines a mapping for the sample data you will use.

    To use cURL, send the following request:

     curl -O https://raw.githubusercontent.com/lucenia/docs/0.1.0/assets/examples/ecommerce-field_mappings.json
    

    To use wget, send the following request:

     wget https://raw.githubusercontent.com/lucenia/docs/0.1.0/assets/examples/ecommerce-field_mappings.json
    

  2. Download ecommerce.json. This file contains the index data formatted so that it can be ingested by the Bulk API:

    To use cURL, send the following request:

     curl -O https://raw.githubusercontent.com/lucenia/docs/0.1.0/assets/examples/ecommerce.json
    

    To use wget, send the following request:

     wget https://raw.githubusercontent.com/lucenia/docs/0.1.0/assets/examples/ecommerce.json
    

  3. Define the field mappings provided in the mapping file:
     curl -H "Content-Type: application/x-ndjson" -X PUT "https://localhost:9200/ecommerce" -ku admin:<custom-admin-password> --data-binary "@ecommerce-field_mappings.json"
    

  4. Upload the documents using the Bulk API:

     curl -H "Content-Type: application/x-ndjson" -X PUT "https://localhost:9200/ecommerce/_bulk" -ku admin:<custom-admin-password> --data-binary "@ecommerce.json"
    

Query the data

Query the data using the Search API. The following query searches for documents in which customer_first_name is Sonya:

GET ecommerce/_search
{
  "query": {
    "match": {
      "customer_first_name": "Sonya"
    }
  }
}

Visualize the data

To learn how to use OpenSearch Dashboards to visualize the data, see the Dashboards quickstart guide.

Further reading

Next steps

350 characters left

Have a question? .