How to find the true score from the Elasticsearch query string using a template?

My ElasticSearch 2.x NEST query string search contains a wildcard:

Using NEST in C #:

var results = _client.Search<IEntity>(s => s
    .Index(Indices.AllIndices)
    .AllTypes()
    .Query(qs => qs
        .QueryString(qsq => qsq.Query("Micro*")))
    .From(pageNumber)
    .Size(pageSize));

Comes to something like this:

$ curl -XGET 'http://localhost:9200/_all/_search?q=Micro*'

This code was obtained on the ElasticSearch page using co-options . The results are co-options; they have a mixed type coming from several indices. The problem I am facing is that all hits are returned with a score of 1.

This is regardless of type or enhancement. Can I activate by type or, alternatively, is there a way to show or "explain" the search result so that I can order by invoice?

+4
source share
2

, wildcard query, , . , .Rewrite().

var results = client.Search<IEntity>(s => s
    .Index(Indices.AllIndices)
    .AllTypes()
    .Query(qs => qs
        .QueryString(qsq => qsq
            .Query("Micro*")
            .Rewrite(RewriteMultiTerm.ScoringBoolean)
        )
    )
    .From(pageNumber)
    .Size(pageSize)
);

RewriteMultiTerm.ScoringBoolean should bool , .

, 1024 bool , corpus; , StackOverflow (, ), . , edgengram.

+4
0

Source: https://habr.com/ru/post/1655242/


All Articles