# App Search - Scoring algorithm in B2B and multi-entity model

**URL:** https://discuss.elastic.co/t/app-search-scoring-algorithm-in-b2b-and-multi-entity-model/311542
**Category:** Elastic Search
**Tags:** elastic-app-search
**Created:** [August 5, 2022, 1:32pm UTC](https://discuss.elastic.co/t/app-search-scoring-algorithm-in-b2b-and-multi-entity-model/311542 "2022-08-05T13:32:16Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Gerardo\_Zenobi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gerardo_zenobi/32/106790_2.png) [@Gerardo\_Zenobi](https://discuss.elastic.co/u/Gerardo_Zenobi)
#### Post date: [August 5, 2022, 1:32pm UTC](https://discuss.elastic.co/t/app-search-scoring-algorithm-in-b2b-and-multi-entity-model/311542/1 "2022-08-05T13:32:16Z")

</div>

Hi 👋

### Context

We have a B2B product. We would like to index different types of entities (e.g. User, Training, Group, etc). [It was recommended](https://discuss.elastic.co/t/multiple-entity-type-indexing-and-search/306718) that the best approach here would be to use one engine per entity.

### Problem/Question

After reading this [article](https://www.infoq.com/articles/similarity-scoring-elasticsearch/) that described how documents are scored, I had the following questions:

- By keeping entities separate in different engines: are we somewhat disadvantaging ourselves because we won't be deriving our inverse document frequencies from the whole corpus (all the entities combined) — rather just, say, from each entity's corpus ?

At the same time, given our product is B2B and that our clients come from all sort of industries:

- is it correct to assume that we wouldn't want the rarity/inverse document frequency of each term to be based on its rarity across all of our clients' data, but only within the documents of a given client (1 client= 1 corpus) ?
- if indeed the above was a problem, would the only solution be having engines by client ? (though I would be scared that having thousands of clients would complexify the solution in this case).  
Perhaps there’s a way to tell ES to calculate IDFs based on a subset of the docs in an index?

Thanks in advance.

---

<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: [September 2, 2022, 1:32pm UTC](https://discuss.elastic.co/t/app-search-scoring-algorithm-in-b2b-and-multi-entity-model/311542/2 "2022-09-02T13:32:25Z")

</div>

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