# Selectively indexing the contents of non-indexed objects

**URL:** <https://discuss.elastic.co/t/selectively-indexing-the-contents-of-non-indexed-objects/75084>\
**Category:** Elasticsearch\
**Created:** [February 14, 2017, 5:30pm UTC](https://discuss.elastic.co/t/selectively-indexing-the-contents-of-non-indexed-objects/75084 "2017-02-14T17:30:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Grannell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryan_grannell/32/41712_2.png) [@Ryan\_Grannell](https://discuss.elastic.co/u/Ryan_Grannell)\
**Post date:** [February 14, 2017, 5:30pm UTC](https://discuss.elastic.co/t/selectively-indexing-the-contents-of-non-indexed-objects/75084/1 "2017-02-14T17:30:57Z")

</div>

Hi,

I currently have an index-template set up to prevent useless or inner-property-heavy data from being indexed, as an attempt to reduce our index field-count. For example, I have certain complex response-bodies that are logged disabled by setting `"enabled": false` in the index template.

Unfortunately, I now need to "re-enable" some sub-properties of a non-indexed object so we can search over them, but not other sub-properties. Here's a concrete example.

Say I have logs of this format coming in:

```
{
	"an_object": {
		"inner_object_1": {
			"useless_prop_0": "**",
			"useless_prop_1": "**",
			
			//.
			//.
			//.

			"useless_prop_n": "**",
			"useful_prop_1": "**",
			"useful_prop_2": "**"
		},
		"inner_object_2": {
			"useless_prop_0": "**",
			"useless_prop_1": "**",
			
			//.
			//.
			//.

			"useless_prop_n": "**"
		}
	}
}

```

Our index-template currently disables `inner_object_1` and `inner_object_2``to keep our field count down.

```
"properties": {
	"an_object": {
		"properties": {
			"inner_object_1": {
				"type"	: "object",
				"enabled": false			
			}
			"inner_object_2": {
				"type"	: "object",
				"enabled": false
			}
		}
	}
}

```

I'd like to index / enable:

- `an_object.inner_object_1.useful_prop_1`
- `an_object.inner_object_1.useful_prop_2`

but ignore any other junk in `an_object.inner_object_1`. I don't want to explicitly list every property I want disabled, as this list can change over time.

Is there some configuration available that would allow for this? For example:

```
"properties": {
	"an_object": {
		"properties": {
			"inner_object_1": {
				"type"	: "object",
				"enabled": false,
				"except_please_do_not_ignore_these_properties": ["useful_prop_1", "useful_prop_2"]
			}
			"inner_object_2": {
				"type"	: "object",
				"enabled": false
			}
		}
	}
}

```

Thanks for your help. If any clarification is needed, let me know,

Regards,  
Ryan

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 16, 2017, 6:53am UTC](https://discuss.elastic.co/t/selectively-indexing-the-contents-of-non-indexed-objects/75084/2 "2017-02-16T06:53:22Z")

</div>

You can use wildcards in mapping/templates, so if the useful fields contain some specific commonality in their names that might work?

---

<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 16, 2017, 6:53am UTC](https://discuss.elastic.co/t/selectively-indexing-the-contents-of-non-indexed-objects/75084/3 "2017-03-16T06:53:27Z")

</div>

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