Delete Documents Flashcards

1
Q

Delete a single document

A

DELETE /my_index/_doc/1
This deletes the document with the ID 1 from the my_index index.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Delete by Query

A

POST /my_index/_delete_by_query
{
“query”: {
“term”: {
“status”: “archived”
}
}
}

In this example, all documents in the my_index index where the status field is “archived” will be deleted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Delete All Documents from an Index

A

POST /my_index/_delete_by_query
{
“query”: {
“match_all”: {}
}
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Delete Documents from Multiple Indices

A

POST /index1,index2/_delete_by_query
{
“query”: {
“term”: {
“category”: “obsolete”
}
}
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Query Params

A

POST /my_index/_delete_by_query?conflicts=proceed

POST /my_index/_delete_by_query?refresh=true

conflicts: Set to “proceed” to continue deleting even if there are version conflicts.
refresh: Set to true to force a refresh after the delete operation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

batch_size parameter

A

POST /my_index/_delete_by_query
{
“query”: {
“term”: {
“status”: “archived”
}
},
“size”: 1000
}

Use the size parameter to control the batch size of each scroll request.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly