# Boosting search results based on the number of items in a nested object

**URL:** <https://discuss.elastic.co/t/boosting-search-results-based-on-the-number-of-items-in-a-nested-object/242357>\
**Category:** Elasticsearch\
**Created:** [July 23, 2020, 2:42pm UTC](https://discuss.elastic.co/t/boosting-search-results-based-on-the-number-of-items-in-a-nested-object/242357 "2020-07-23T14:42:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![waynesmallman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/waynesmallman/32/18596_2.png) [@waynesmallman](https://discuss.elastic.co/u/waynesmallman)\
**Post date:** [July 23, 2020, 2:42pm UTC](https://discuss.elastic.co/t/boosting-search-results-based-on-the-number-of-items-in-a-nested-object/242357/1 "2020-07-23T14:42:34Z")

</div>

Hi!

I have an index that contains a nested object:

```
"links_to_asset": {
	"type": "nested",
	"properties": {
		"note_link_id": {
			"type": "long"
		},
		"user_id": {
			"type": "long"
		},
		"to_asset": {
			"type": "integer"
		},
		"from_asset": {
			"type": "integer"
		}
	}
}

```

I'm using the nested object to track the number of assets that linking to an asset.

I would like to use the number of links to an asset is the scoring for the search results.

As an example, in the search object, I have:

```
should: [
  {
    term: {
      favourite: {
        value: 1,
        boost: 2
      }
    }
  }
}

```

Here, an asset that is a favourite is given a boost.

Is it possible to use the number of links as a criteria for the search?

---

<div class="post-metadata">

**Author:** ![waynesmallman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/waynesmallman/32/18596_2.png) [@waynesmallman](https://discuss.elastic.co/u/waynesmallman)\
**Post date:** [July 27, 2020, 1:33pm UTC](https://discuss.elastic.co/t/boosting-search-results-based-on-the-number-of-items-in-a-nested-object/242357/2 "2020-07-27T13:33:09Z")

</div>

Hi!

Would I need to use a term-sum combination or aggregate for this?

---

<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:** [August 24, 2020, 1:33pm UTC](https://discuss.elastic.co/t/boosting-search-results-based-on-the-number-of-items-in-a-nested-object/242357/3 "2020-08-24T13:33:18Z")

</div>

Closed on August 24, 2020, 1:33pm UTC

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