Search code examples
c#elasticsearchnest

What's the minimum and maximum value of the query field boost weight by default?


What's the minimum and maximum value for the query boost parameter? I can't find it anywhere in the ES docs.

Also, can the boost parameter be a double like 2.2? or 2.22?

This is how my query looks like:

response = await ElasticClient.SearchAsync<Product>(s => s
     .From(skip)
     .Size(productSearch.ItemsPerPage)
     .Index(productSearch.Company + PartOfIndexName + productSearch.Country)
     .Query(q => q
           .QueryString(qs => qs
               .Fields(fs => fs
               .Field(f => f.IdPart1, 4.00)
               .Field(f => f.Title, 3.50)
               .Field(f => f.BrandName, 3.00)
               .Field(f => f.Description, 2.00)
               )
               .Query("*" + productSearch.Query + "*")
              )
            )
      );

Solution

  • Yes, the boost can be a float value.

    Hence, the max boost you can give is Float.MAX_VALUE