Ranking not working for Search query with AllIndices

Hi, I am using rankfeature for ranking purpose,
Since there are multiple (4) indexes, the search query result with option AllIndices
the result is not correctely sorted, seems ranking working for indvisual index and then concat the documents which leads to incorrect order

Please suggest
`var searchResponse = await elasticClient.SearchAsync(body => body
.AllIndices()
.Query(qx => qx.Bool
(bb => bb.Must(q =>
(
q.Term(x => x.Field(f => f.ClientId).Value(data.ClientId))
)
&&
(

            data.Category == Filters.Tags.ToString() ? q.Terms(c => c.Field(p => p.Tags).Terms(words))
            :
            (data.Category == Filters.Content.ToString() ?
            (
           (q.Term(x => x.Field(f => f.CustomDocType).Value("1")) &&
            (
            (Settings.EnableMultiMatchPharsePrefix ? q.MatchPhrasePrefix(m => m.Field(f => f.Attachment.Content).Query(data.SearchText).Slop(Settings.Slop)) :
            (Settings.EnableFuzziness ? q.MultiMatch(m => m.Fields(f => f.Field(p => p.Attachment.Content)).Fuzziness(Fuzziness.Auto).Query(data.SearchText)) :
            q.MultiMatch(m => m.Fields(f => f.Field(p => p.Attachment.Content)).Query(data.SearchText)))
            )
            ||
            (Settings.EnableWildCard ? (part.Length >= MINIMUM_LENGTH ? (q.Wildcard(f => f.Field(p => p.Attachment.Content.ToLower()).Value("*" + part.ToLower() + "*"))) : null) : null)
            ))
            ||
             (
              q.Term(x => x.Field(f => f.CustomDocType).Value("2")) &&
             (
            (Settings.EnableMultiMatchPharsePrefix ? q.MatchPhrasePrefix(m => m.Field(f => f.Content).Query(data.SearchText).Slop(Settings.Slop)) :
            (Settings.EnableFuzziness ? q.MultiMatch(m => m.Fields(f => f.Field(p => p.Content)).Fuzziness(Fuzziness.Auto).Query(data.SearchText)) :
            q.MultiMatch(m => m.Fields(f => f.Field(p => p.Content)).Query(data.SearchText)))
            )
            ||
            (Settings.EnableWildCard ? (part.Length >= MINIMUM_LENGTH ? (q.Wildcard(f => f.Field(p => p.Content.ToLower()).Value("*" + part.ToLower() + "*"))) : null) : null)
            ))
            )
             :
             null
            )

             ))
      .Should(s => Settings.EnableRanking ? s.RankFeature(r => r.Field(f => f.Rank).Saturation()) : null)

         ))
     .Size(Settings.Size)
      );

`

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