# How to search for information in span.attributes.\*

**URL:** https://forum.opensearch.org/t/how-to-search-for-information-in-span-attributes/9955
**Category:** Data Prepper
**Created:** [June 16, 2022, 8:20am UTC](https://forum.opensearch.org/t/how-to-search-for-information-in-span-attributes/9955 "2022-06-16T08:20:32Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![charles.liu](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@charles.liu](https://forum.opensearch.org/u/charles.liu)
#### Post date: [June 16, 2022, 8:20am UTC](https://forum.opensearch.org/t/how-to-search-for-information-in-span-attributes/9955/1 "2022-06-16T08:20:32Z")

</div>

How to search for information in span.attributes.\*. For example, if I put the user id in span.attributes, I want to find the associated trace by the user id.

span.attributes.member\_id: 12306

---

<div class="post-metadata">

### Author: ![qchea](https://avatars.discourse-cdn.com/v4/letter/q/2acd7d/32.png) [@qchea](https://forum.opensearch.org/u/qchea)
#### Post date: [June 17, 2022, 2:36pm UTC](https://forum.opensearch.org/t/how-to-search-for-information-in-span-attributes/9955/3 "2022-06-17T14:36:58Z")

</div>

Hi, @charles.liu . In our [raw trace index template](https://github.com/opensearch-project/data-prepper/blob/fe138f5d844b02c4b67378468604a15e9ada4537/data-prepper-plugins/opensearch/src/main/resources/otel-v1-apm-span-index-template.json#L19) fields in span.attributes.\* are identified as keyword. So you should be able to do term query as normal and output any other fields (e.g. traceId) by specifying field names.
