Elasticsearch API and Ingestion Pipeline
Last updated
Last updated
Task:
Create a new index containing three documents. After creation, delete one document using the DELETE method and another using a query-based deletion. Then, reindex the remaining documents and perform an index flush.
First, let's open Kibana Dev Tools and initiate the creation of a new index.
Now, let's add three documents to this index:
Now, let's proceed with deleting the first document.
Next, let's try delete one document by query.
We now need to reindex the documents, which enables us to copy them from one index to another. Before reindexing, we need to create a new index
Now, let's reindex the data from weinnovate
to weinnovate_new
.
Flushing an index in Elasticsearch ensures that all operations are written to disk. This can help free up memory and optimize performance.
Ingest pipelines let you perform common transformations on your data before indexing. For example, you can use pipelines to remove fields, extract values from text, and enrich your data.
Task: Create a pipeline with three distinct processors for a new index.
First, we will create a pipeline named weinnovate_pipeline
, which will include three processors.
The append
processor adds a new value "Active"
to the Status
field.
The convert
processor converts the value of "age"
to an integer
.
The uppercase
processor converts the "name"
field to uppercase
.
We need to confirm that the pipeline was created successfully.
Now, I want to apply this pipeline to the previously created "weinnovate"
index. To do this, we first need to reindex the existing data while applying the pipeline during the reindexing process.
Let's verify this by retrieving the documents from the weinnovate_two
index.
Alternatively, we can first create the pipeline and then apply it when creating a new index.