English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Elasticsearch Ingest Node

index.blocks.read_only1 true/false

Setting it to true will make the index and index metadata read-only, while setting it to false will allow writing and metadata changes.

Sometimes we need to index the document before transforming it. For example, we want to delete a field or rename a field from the document and then index it. This is handled by the Ingest node.

Each node in the cluster has an extraction function, but it can also be customized so that it is only processed by specific nodes.

Step

The work of the ingestion node involves two steps-

  • Create pipeline

  • Establishing file

Create pipeline

First, create a pipeline containing processors and then execute the pipeline, as follows-

PUT _ingest/pipeline/int-converter
{
   "description": "converts the content of the seq field to an integer"
   "processors" : [
      {
         "convert" : {
            "field" : "seq",
            "type": "integer"
         }
      }
   ]
}

When running the above code, we get the following results-

{
   "acknowledged" : true
}

Establishing file

Next, we use the pipeline converter to create a document.

PUT /logs/_doc/1?pipeline=int-converter
{
   "seq":"21",
   "name":"w"3codebox",
   "Addrs":"Hyderabad"
}

After running the above code, we get the following response:

{
   "_index": "logs",
   "_type": "_doc",
   "_id": ""1",
   "_version": 1,
   "result" : "created"
   "_shards" : {
      "total" : 2,
      "successful" : 1,
      "failed" : 0
   },
   "_seq_no" : 0,
   "_primary_term": 1
}

Next, we use the GET command to search for the document created above, as follows-

GET /logs/_doc/1

When running the above code, we get the following results-

{
   "_index": "logs",
   "_type": "_doc",
   "_id": ""1",
   "_version": 1,
   "_seq_no" : 0,
   "_primary_term": 1,
   "found": true,
   "_source": {
      "Addrs" : "Hyderabad",
      "name" : "w"3codebox",
      "seq": : 21
   }
}

You can see above21Convert to an integer.

No pipeline

Now, we can create documents without using a pipeline.

PUT /logs/_doc/2
{
   "seq":"11",
   "name":"Tutorix",
   "Addrs":"Secunderabad"
}
GET /logs/_doc/2

When running the above code, we get the following results-

{
   "_index": "logs",
   "_type": "_doc",
   "_id": ""2",
   "_version": 1,
   "_seq_no": 1,
   "_primary_term": 1,
   "found": true,
   "_source": {
      "seq": ""11",
      "name": "Tutorix",
      "Addrs": "Secunderabad"
   }
}

You can see above11It is a string that does not use a pipe.