# Retrieve transactions from APM using NEST

**URL:** <https://discuss.elastic.co/t/retrieve-transactions-from-apm-using-nest/274924>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [June 3, 2021, 9:28pm UTC](https://discuss.elastic.co/t/retrieve-transactions-from-apm-using-nest/274924 "2021-06-03T21:28:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoviceESCoder](https://avatars.discourse-cdn.com/v4/letter/n/ec9cab/32.png) [@NoviceESCoder](https://discuss.elastic.co/u/NoviceESCoder)\
**Post date:** [June 3, 2021, 9:28pm UTC](https://discuss.elastic.co/t/retrieve-transactions-from-apm-using-nest/274924/1 "2021-06-03T21:28:29Z")

</div>

I have an [asp.net](http://asp.net) core web app application that will write logs using serilog to elasticsearch and also can read the logs from elasticsearch using NEST. I also have it set up where I can use APM for my application. **If I wanted to retrieve the transactions that are in APM using NEST or the transactions on a specific date, is this something possible?** Any advice/tutorial/documentation on this would be great!

[![enter image description here](https://i.stack.imgur.com/yM3Th.png)](https://i.stack.imgur.com/yM3Th.png)

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [June 4, 2021, 2:59pm UTC](https://discuss.elastic.co/t/retrieve-transactions-from-apm-using-nest/274924/2 "2021-06-04T14:59:00Z")

</div>

Yes, this is possible, APM data is like any other data in elasticsearch, so you have access to it.

[Here](https://www.elastic.co/guide/en/apm/server/current/exploring-es-data.html#exploring-es-data) is a good documentation on how APM data is stored - you can just query those indices.

---

<div class="post-metadata">

**Author:** ![NoviceESCoder](https://avatars.discourse-cdn.com/v4/letter/n/ec9cab/32.png) [@NoviceESCoder](https://discuss.elastic.co/u/NoviceESCoder)\
**Post date:** [June 4, 2021, 8:19pm UTC](https://discuss.elastic.co/t/retrieve-transactions-from-apm-using-nest/274924/3 "2021-06-04T20:19:05Z")

</div>

You are the best! @GregKalapos Thank you!!

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [June 6, 2021, 11:44pm UTC](https://discuss.elastic.co/t/retrieve-transactions-from-apm-using-nest/274924/4 "2021-06-06T23:44:15Z")

</div>

[Answered the same question on Stack Overflow](https://stackoverflow.com/a/67830576/1831), including here for completeness.

You'll want to target the `apm-*-transaction` aliase(s)

In Kibana Dev tools

```json
GET apm-*-transaction/_search
{
  "query": {
    "range": {
      "@timestamp": {
        "gte": "2021-06-04T00:00:00Z",
        "lte": "2021-06-05T00:00:00Z"
      }
    }
  }
}

```

In NEST (change `dynamic` to your document type)

```auto
var client = new ElasticClient();
	
var searchResponse = client.Search<dynamic>(s => s
	.Index("apm-*-transaction")
	.Query(q => q
		.DateRange(dr => dr
			.Field("@timestamp")
			.GreaterThanOrEquals("2021-06-04T00:00:00Z")
			.LessThanOrEquals("2021-06-05T00:00:00Z")
		)
	)
);

```

---

<div class="post-metadata">

**Author:** ![NoviceESCoder](https://avatars.discourse-cdn.com/v4/letter/n/ec9cab/32.png) [@NoviceESCoder](https://discuss.elastic.co/u/NoviceESCoder)\
**Post date:** [June 7, 2021, 1:38pm UTC](https://discuss.elastic.co/t/retrieve-transactions-from-apm-using-nest/274924/5 "2021-06-07T13:38:33Z")

</div>

Thank you for the detailed explanation!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 28, 2021, 9:39am UTC](https://discuss.elastic.co/t/retrieve-transactions-from-apm-using-nest/274924/6 "2021-06-28T09:39:34Z")

</div>

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