Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

398
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!