Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

408
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda