Elastic Search-Search string com espaços e caracteres especiais usando C #

Eu estou procurando a consulta de ninho ElasticSearch, que fornecerá a correspondência exata na string com espaços usando C #.

por exemplo - eu quero procurar uma palavra como 'XYZ Company Solutions'. Eu tentei querystring query, mas ele fornece todos os registros, independentemente do resultado da pesquisa. Também li no post e descobri que temos que adicionar alguns mapeamentos para o campo. Tentei o analisador 'Not_Analyzed' em campo, mas ainda não funcionou.

Aqui está o meu código de c #

var indexDefinition = new RootObjectMapping
{
  Properties = new Dictionary<PropertyNameMarker, IElasticType>(),
  Name = elastic_newindexname
};
var notAnalyzedField = new StringMapping
{
  Index = FieldIndexOption.NotAnalyzed
};
indexDefinition.Properties.Add("Name", notAnalyzedField);
objElasticClient.DeleteIndex(d => d.Index(elastic_newindexname));
var reindex = objElasticClient.Reindex<dynamic>(r => r.FromIndex(elastic_oldindexname).ToIndex(elastic_newindexname).Query(q => q.MatchAll()).Scroll("10s").CreateIndex(i => i.AddMapping<dynamic>(m => m.InitializeUsing(indexDefinition))));
ReindexObserver<dynamic> o = new ReindexObserver<dynamic>(onError: e => { });
reindex.Subscribe(o);**

**ISearchResponse<dynamic> ivals = objElasticClient.Search<dynamic>(s => s.Index(elastic_newindexname).AllTypes().Query(q => q.Term("Name","XYZ Company Solutions")));** //this gives 0 records

**ISearchResponse<dynamic> ivals1 = objElasticClient.Search<dynamic>(s => s.Index(elastic_newindexname).AllTypes().Query(q => q.Term(u => u.OnField("Name").Value("XYZ Company Solutions"))));** //this gives 0 records

**ISearchResponse<dynamic> ivals = objElasticClient.Search<dynamic>(s => s.Index(elastic_newindexname).AllTypes().Query(@"Name = 'XYZ Company Solutions'"));** //this gives all records having fields value starting with "XYZ"

Se alguém tiver exemplo completo ou etapas em C #, você pode compartilhar comigo?

questionAnswers(3)

yourAnswerToTheQuestion