Filter Based On Average Score

Hi, I have an index keeps items.
My search structure like below:

    QueryContainer filterDescription = null;
    			QueryContainer filterItemNo = null;
    			QueryContainer filterModelNo = null;
    			QueryContainer queryMain = null;
    			
    			foreach (string inpValue in arrSearch)
    			{
    				filterDescription |= new WildcardQuery() { Field = "searchfor_description", Value = "*" + inpValue + "*" };
    				filterItemNo |= new WildcardQuery() { Field = "searchfor_itemno", Value = "*" + inpValue + "*" };
    				filterModelNo |= new WildcardQuery() { Field = "searchfor_modelno", Value = "*" + inpValue + "*" };
    				
    				queryMain &= new WildcardQuery() { Field = "searchfor_all", Value = "*" + inpValue + "*" };
    			}
    			
    			double weightItemNo = 10000;
    			double weightModelNo = 100;
    			double weightDescription = 1;

    			ElasticClient elasticClient = new ElasticClient(new ConnectionSettings(
                    new Uri("my url"))
                    .RequestTimeout(TimeSpan.FromMinutes(5))
                    .DefaultIndex("items")
                    );
    					
                ISearchResponse<items> seachResultItem = elasticClient.Search<items>(s => s
                    .RequestConfiguration(r => r.DisableDirectStreaming())
                    .From(filtre.PageNo == 1 ? 0 : (filtre.PageNo * filtre.PageCount) - filtre.PageCount)
                    .Size(filtre.PageCount)
                    .Sort(sc => sc.Descending(SortSpecialField.Score))
                    .Query(q => q
                     .FunctionScore(fs => fs
                            .Functions(fu => fu
                                .Weight(w => w
                                    .Weight(weightDescription)
                                    .Filter(wf => wf
                                    .Bool(bb => bb
                                    .Must(filterDescription))
                                    ))
                                )
                            .Functions(fu => fu
                                .Weight(w => w
                                    .Weight(weightItemNo)
                                    .Filter(wf => wf
                                    .Bool(bb => bb
                                    .Must(filterItemNo))
                                    ))
                                )
                            .Functions(fu => fu
                                .Weight(w => w
                                    .Weight(weightModelNo)
                                    .Filter(wf => wf
                                    .Bool(bb => bb
                                    .Must(filterModelNo))
                                    ))
                                )
                    .Query(q2 => q2
                        .Bool(b => b
                        .Should(queryMain))
                        )
                    ))
                );

I need to filter by average score.
For example, written keywords match the item number field, and one of them matches the description field. Its score will be under average and I would not like to show it.
I do not know if I've explained and I do not know if I'm going in the right way?

Kindly regards.

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