# Source\_filtering by value not field

**URL:** https://discuss.elastic.co/t/source-filtering-by-value-not-field/120633
**Category:** Elasticsearch
**Created:** [February 20, 2018, 12:05pm UTC](https://discuss.elastic.co/t/source-filtering-by-value-not-field/120633 "2018-02-20T12:05:28Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Yair\_Halberstadt](https://avatars.discourse-cdn.com/v4/letter/y/779978/32.png) [@Yair\_Halberstadt](https://discuss.elastic.co/u/Yair_Halberstadt)
#### Post date: [February 20, 2018, 12:05pm UTC](https://discuss.elastic.co/t/source-filtering-by-value-not-field/120633/1 "2018-02-20T12:05:28Z")

</div>

My documents contains a nested array of Ids.

I want to filter on these IDs (eg return only those documents where one of the IDs is 6489354).

There might be thousands of IDs, so I only want to return the the source where those IDs are equal to certain values (eg.1,6,or 9)

So lets say I had these two documents:

```
{
	{Name:Document1}
	Nested IDs
	[
		{ID:1}
		{ID:5}
		{ID:9}
		{ID:6489354}
	]
}

{
	{Name:Document2}
	Nested IDs
	[
		{ID:1}
		{ID:5}
		{ID:9}
	]
}

```

Only document1 should be returned, and it's source should be:

```
{
	{Name:Document1}
	Nested IDs
	[
		{ID:1}
		{ID:9}
	]
}

```

Currently sourceFiltering does not work on values, only fields. Is there some other way around this?

Thanks

---

<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: [March 20, 2018, 12:05pm UTC](https://discuss.elastic.co/t/source-filtering-by-value-not-field/120633/2 "2018-03-20T12:05:34Z")

</div>

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