# How filter by value in a field that looks as array of lists

**URL:** <https://community.opentargets.org/t/how-filter-by-value-in-a-field-that-looks-as-array-of-lists/940>\
**Category:** Google BigQuery/Cloud\
**Created:** [8 February 2023 22:18 UTC](https://community.opentargets.org/t/how-filter-by-value-in-a-field-that-looks-as-array-of-lists/940 "2023-02-08T22:18:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vmorozov](https://dub1.discourse-cdn.com/flex017/user_avatar/community.opentargets.org/vmorozov/32/371_2.png) [@vmorozov](https://community.opentargets.org/u/vmorozov)\
**Post date:** [8 February 2023 22:18 UTC](https://community.opentargets.org/t/how-filter-by-value-in-a-field-that-looks-as-array-of-lists/940/1 "2023-02-08T22:18:08Z")

</div>

Hi,  
Try to filter by value in a field that looks as array of lists.

SELECT targetId, diseaseId, textMiningSentences FROM `open-targets-prod.platform.evidence` as ev where datasourceId=‘europepmc’ and targetId=‘ENSG00000127318’ and diseaseId=‘EFO\_0000274’ and **textMiningSentences.section=‘abstract’** LIMIT 1000

get error:  
Field name section does not exist in STRUCT\<list ARRAY\<STRUCT\<element STRUCT\<dEnd INT64, dStart INT64, section STRING, …\>\>\>\> at [1:212]

---

<div class="post-metadata">

**Author:** ![dsuveges](https://dub1.discourse-cdn.com/flex017/user_avatar/community.opentargets.org/dsuveges/32/30_2.png) [@dsuveges](https://community.opentargets.org/u/dsuveges)\
**Post date:** [23 February 2023 14:39 UTC](https://community.opentargets.org/t/how-filter-by-value-in-a-field-that-looks-as-array-of-lists/940/2 "2023-02-23T14:39:22Z")

</div>

Hi There,

The problem is that you cannot apply a filter on nested structures, you need to “unnest” fist to get a flat structure like this:

```sql
SELECT
  targetId,
  diseaseId,
  textMiningSentences,
FROM
  open-targets-prod.platform.evidence AS ev,
  UNNEST(textMiningSentences.list) as t
WHERE
  datasourceId="europepmc"
  AND targetId="ENSG00000127318"
  AND diseaseId="EFO_0000274"
  AND t.element.section = "abstract"
LIMIT 1000

```

The above solution only provides matches in the abstracts, not in other sections. But it can give you some inspiration on how to go further: by joining this table by targetId, diseaseId, pmid, you can get all textMiningSentences for these publications.
