I am new to ElasticSearch NEST and trying to integrate in my application. One issue i am facing while searching with Alphanumeric feild like I have one feild UniqueID whose value starts with 'h' and followed by some integers values and length of the feild value is 11.
For Example :
UniqueID
h4212423321
h4212423122
h4212413323
h4212421324
h4212423225
h4212423316
Like this i have more than 100000 records data to be indexed.
Problem : When i search for UniqueID='h', I am getting max 250 results only, But all the 100000 records startswith 'h'. So all records should come. I need help in searching all data.
Please find the my Query Code :
var result = client.Search<MemberListDto>(s => s
.Size(10000)
.Query(q =>
q.MatchPhrasePrefix((mq => mq.Field(f => f.UniqueID).Query(UniqueID)))
));
return result.Total;
My POCO c# class for this is
public class MemberListDto
{
[String(Analyzer = "keyword", SearchAnalyzer = "keyword")]
public string UniqueID { get; set; }
[String(Analyzer = "keyword", SearchAnalyzer = "keyword")]
public string SubscriberID { get; set; }
}
My Method to index list of MemberListDto is :
public void CreateBulkIndex(List data, string indexName, string typeName) where T : class
{
if (!_client.IndexExists(ElasticConfig.IndexName).Exists)
{
var indexDescriptor = new CreateIndexDescriptor(ElasticConfig.IndexName)
.Mappings(ms => ms
.Map<T>(m => m.AutoMap()));
_client.CreateIndex(ElasticConfig.IndexName, i => indexDescriptor);
}
_client.Bulk(b => b.IndexMany(data, (d, doc) => d.Document(doc).Index(indexName)));
}