Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

400
Visualizações
ElasticSearch - NEST searching for partial string multi-match

I have an application (.net core + ReactJS) that I have to figure out and make a mod, but come to find out that it is using a lot of technologies that I am not familiar with, in this case, ElasticSearch. Currently, a search of a term Micro, will not return anything, because apparently, it is looking for an exact match, but What I am trying to achieve is that a search for Micro should return Microsoft, MicroStrategy...and anything that contains "micro" in the name, how do I accomplish that in the following code? I tried to do some research, i see things like ngram, analyzer, query_string or QueryString...no idea where to start. Please help.

public SearchDescriptor<ProductRecord> BuildSearchDescriptor(
            string productType,
            string name,
            int page ,
            int pageSize ,
            Dictionary<string, List<string>> filters)
        {
            ValidateProductType(productType);
            var collection = ProductTypeToCollection[productType];

            var searchDescriptor = new SearchDescriptor<ProductRecord>()
                .Index(collection)
                .From(page * pageSize)
                .Size(pageSize)
                .Query(q => q
                    .Bool(bq => bq
                        .Must(m => m
                            .MultiMatch(c => c
                                    .Query(name)
                                    .Fields(ff => ff
                                        .Field(f => f.Product, boost: ProductBoost)
                                        .Field(f => f.Manufacturer, boost: ManufacturerBoost)
                                        .Field(f => f.Version)
                                        .Field(f => f.Id, boost: 50)
                                    )
                                    .Type(TextQueryType.CrossFields)
                                //.Type(TextQueryType.BestFields)
                            ))
                        .Filter(fq => AddFilters(fq, filters))
                    )
                )
                .Sort(ss => ss
                        .Descending(SortSpecialField.Score)
                        .Ascending(p => p.Product.Suffix("keyword"))
                        .Ascending(p => p.Manufacturer.Suffix("keyword"))
                        .Descending(p => p.Version.Suffix("keyword"))
                    /*.Script(sc => sc
                        .Type("number")
                        .Descending()
                        .Script(script => script
                            .Source("doc['VERSION'].value")))
                            */
                );
            return searchDescriptor;
        }
}
over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda