Search API responses doesn't include primary identifiers (id)

Versions 3.4

Describe the issue:

Hello.

Search API is great, but the response doesn’t contain id identifiers, for example, search monitors API here API - OpenSearch Documentation

Example:

  • Search monitor by monitor.name
  • Get response (see below)
  • I can’t find ID in the response to use it in another my next steps - for example, delete or update monitor since it requires id as request parameter `DELETE _plugins/_alerting/monitors/<monitor_id>`

Is it possible to add primary identifier to search APIs ? Thanks a lot

{
  "took": 17,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 0.6931472,
    "hits": [{
      "_index": ".opensearch-scheduled-jobs",
      "_type": "_doc",
      "_id": "eGQi7GcBRS7-AJEqfAnr",
      "_score": 0.6931472,
      "_source": {
        "type": "monitor",
        "name": "my-monitor-name",
        "enabled": true,
        "enabled_time": 1545854942426,
        "schedule": {
          "period": {
            "interval": 1,
            "unit": "MINUTES"
          }
        },
        "inputs": [{
          "search": {
            "indices": [
              "*"
            ],
            "query": {
              "size": 0,
              "query": {
                "bool": {
                  "filter": [{
                    "range": {
                      "@timestamp": {
                        "from": "{{period_end}}||-1h",
                        "to": "{{period_end}}",
                        "include_lower": true,
                        "include_upper": true,
                        "format": "epoch_millis",
                        "boost": 1
                      }
                    }
                  }],
                  "adjust_pure_negative": true,
                  "boost": 1
                }
              },
              "aggregations": {}
            }
          }
        }],
        "triggers": [{
          "id": "Sooi7GcB53a0ewuj_6MH",
          "name": "Over",
          "severity": "1",
          "condition": {
            "script": {
              "source": "_ctx.results[0].hits.total > 400000",
              "lang": "painless"
            }
          },
          "actions": []
        }],
        "last_update_time": 1545854975758
      }
    }]
  }
}

Configuration:

Relevant Logs or Screenshots:

@coden Thank you for the question, but is the ID not already returned in the hits.hits[0]._id, in the example above: eGQi7GcBRS7-AJEqfAnr

Using this ID you can then delete the monitor using the following command:

DELETE _plugins/_alerting/monitors/eGQi7GcBRS7-AJEqfAnr

Or perhaps could you elaborate on the question please?