MVC 4 + NEST (ElasticSearch) - ElasticClient

0

I am using MVC 4 and I am doing tests to use NEST (ElasticSearch).

When I run the following code:

var node = new Uri("miURI");

var settings = new ConnectionSettings(
            node
);

 NameValueCollection headerAuthorization = new NameValueCollection { { "Authorization", "" } };
 settings.GlobalHeaders(headerAuthorization);

 settings.DefaultIndex("school");

 var client = new ElasticClient(settings);
 var searchResults = client.Search<School>(search =>
 search.Highlight(descriptor => descriptor.PreTags("<strong>").PostTags("</strong>"))
       .Query(q => q.Bool(b => b.Should(should => should.Bool(b2 => b2.Must(
          must => must.Term(term => term.Address.Country.Name, "es"),
          must => must.MultiMatch(descriptor =>
            descriptor.Query("Colegio").Type(TextQueryType.CrossFields)
              .Fields(fieldsDescriptor => fieldsDescriptor.Fields("name^3", "address.city.name", "address.state.name")))))))));

The URI that generates me is "miURI / school / school / _search".

Why do you repeat "school" twice? Repeating the index twice gives me an error.

    
asked by Nacho 19.04.2018 в 10:42
source

0 answers