Search Events from users with a given email suffixUpdated 13/10/2019


This query template returns events for all "Added Tag" events for users whose email domain is example.com


Query

Note: Remove exact from the query if you wish to match on partial strings.

POST https://{{ organization}}/api/v1/search/events

{
    "query": {
        "bool": {
            "filter": [
                {
                    "has_parent": {
                        "parent_type": "user_report",
                        "query": {
                            "terms": {
                                "email.exact": ["example.com"]
                            }
                        }
                    }
                },
                {
                    "terms": {
                        "event": [
                            "Added Tag"
                        ]
                    }
                }
            ]
        }
    },
    "raw": true,
    "page": 1,
    "per_page": 10,
    "sort": {
        "created_at": "desc"
    }
}

Response

{
  "pagination": {
    "total": 1,
    "page": 1,
    "pages": 1,
    "per_page": 10
  },
  "data": [
    {
      "doctype": "event",
      "app_name": "Intercom",
      "indexed_at": "2019-07-18T13:02:38+00:00",
      "context": {
        "days_since_signup": 0
      },
      "created_at": "2019-07-18T13:02:04Z",
      "session_id": null,
      "source": "Intercom",
      "event": "Added Tag",
      "type": "event",
      "app_id": "584970bd05fd09bbbc0041c2",
      "props": [
        {
          "text_value": "2019-07-18 13:02:37 UTC",
          "date_value": "2019-07-18T13:02:37Z",
          "num_value": 1563454957,
          "field_name": "created_at"
        },
        {
          "text_value": "false",
          "bool_value": false,
          "field_name": "intercom/anonymous"
        },
        {
          "text_value": "2019-07-18T13:02:03+00:00",
          "date_value": "2019-07-18T13:02:03+00:00",
          "num_value": 1563454923,
          "field_name": "intercom/created_at"
        },
        {
          "text_value": "user@example.com",
          "field_name": "intercom/email"
        },
        {
          "text_value": "5d306dcb2344fd4bb6e750c5",
          "field_name": "intercom/id"
        },
        {
          "text_value": "0",
          "num_value": 0.0,
          "field_name": "intercom/session_count"
        },
        {
          "text_value": "false",
          "bool_value": false,
          "field_name": "intercom/unsubscribed_from_emails"
        },
        {
          "text_value": "2019-07-18T13:02:03+00:00",
          "date_value": "2019-07-18T13:02:03+00:00",
          "num_value": 1563454923,
          "field_name": "intercom/updated_at"
        },
        {
          "text_value": "user@example.com",
          "field_name": "email"
        }
      ],
      "_id": "5d306dcd48a4a68087007467:created",
      "_type": "event",
      "_index": "organization_a239c5b2_user_reports_v2_20190916162730757",
      "_score": null,
      "_parent": "5d306ded55590cf17a0053da"
    }
  ]
}