I have documents containing the field "Status", this can have three values "Draft", "In Progress", or "Approved". I am trying to pass this document through a ingest pipeline, and if the status is equal to "Approved" then it should add it in the B index, whereas by default it should index in A index irrespective of status value. for ex - 1.
{
"id":"123",
"status":"Draft"
}
{
"id":"1234",
"status":"InProgress"
}
{
"id":"12345",
"status":"Approved"
}
1,2,3 document should go to A Index and only document 3 should go to B Index Is it possible to do it via Ingest Pipeline?
In your ingest pipeline, you can change the
_index
field very easily like this:It is worth nothing, though, that you cannot send a document to two different indexes within the same pipeline, it's either
index-a
orindex-b
, but not both.However, this can easily be solved by querying both indexes through an alias that spans both
index-a
andindex-b