How do I delete data from elasticsearch within a Range?

How do I delete data from Elasticsearch within a Range?
I'm looking for an example.
between 2022-01-22 and 2022-05-28

Hi!

Read about Delete by Query. Try this:

POST teste/_delete_by_query
{
  "query": {
    "range": {
      "field_date": {
        "lt": "2022-05-06",
        "gt": "2022-05-01"
      }
    }
  }
}
2 Likes

[quote="RabBit_BR, post:2, topic:305858"]
teste

[quote]

I have questions.

  1. Is it an index?
    (teste)

  2. What does teste mean? Can you explain it?

  3. Can I delete the data without an index?

I tried with index but I got an answer like this. can you help me?

POST /dome-plan-1.0.2022.05.30-00001/_delete_by_query
{
"query": {
"range": {
"field_date": {
"lt": "2022-05-30",
"gt": "2022-04-01"
}
}
}
}

{
"took": 804,
"timed_out": false,
"total": 0,
"deleted": 0.
"batches": 0.
0, "version_conflicts": 0.
0, "noops": 0,
"retries":
0, "bulk": 0,
"search": 0
},
0, "throttled_millis": 0,
"requests_per_second": -1.0%
"throttled_until_millis" : 0,
"failures":
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.