Search for Events performed by users in a given AccountUpdated 13/10/2019


This query template returns events for all "User Created" events for users belonging to domain 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 filters events based on their parent object (Users)
                    "has_parent": {
                        "parent_type": "user_report",
                        "query": {
                            "terms": {
                 // here we request that the User object has an account.domain set to `example.com` or `foo.com`
                                "account.domain.exact": ["example.com", "foo.com"]
                            }
                        }
                    }
                },
                { 
          // we request events with name === "User created", or name === "Added Tag"
          // you can 
                    "terms": {
                        "event": [
                            "User created", "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": "User created",
      "type": "user_created",
      "app_id": "584970bd05fd09bbbc0041c3",
      "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": "potato@potato.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": "potato@potato.com",
          "field_name": "email"
        }
      ],
      "_id": "5d306dcd48a4a68087007467:created",
      "_type": "event",
      "_index": "organization_a239c5b2_user_reports_v2_20190916162730757",
      "_score": null,
      "_parent": "5d306ded55590cf37a0053da"
    }
  ]
}