Field_value_factor on a nested field value

Hi - I have an index with a nested array of objects that represent how tenants (in a multitenant app) relate to each item, and I want to boost (I'm thinking via field_value_factor?) using values in those fields. So, example data:

{
  id: "1",
  body: "document content #1",
  tenant_stats: [
    {
      tenant_id: 1,
      views: 245
    },
    {
      tenant_id: 2,
      views: 145
    }
  ]
},
{
  id: "2",
  body: "document content #2",
  tenant_stats: [
    {
      tenant_id: 1,
      views: 43
    },
    {
      tenant_id: 2,
      views: 5789
    }
  ]
}

So in this case I'd want to make queries from tenant 1 prioritize document 1 above 2, since it has more views from them and is therefore more popular, and vice versa for tenant 2. Is this easily doable?

Thanks!

1 Like

Yes you want to use field_value_factor using views to boost the score. You may want to use nested documents, if you want to keep the relevance between tenant_id and views. See this recent post about a similar question: