I'm very new to NEST and Elasticsearch but at my workplace they asked me to produce a wpf client to search and retrieve documents from elasticsearch.
This is an example of what is stored in Elastic
{
"_index" : "testing_devices",
"_type" : "_doc",
"_id" : "0o6ZeX8BRPRTU2ODedUM",
"_score" : 1.0,
"_source" : {
"timestamp_Local" : "2022-03-11T16:29:34.5763990 01:00",
"event" : "TestLog",
"log" : {
"Guid" : "d8bb9004-7cb1-4594-8c93-80135a8b736c",
"SerialNumber" : "",
"RecordType" : 0,
"Operatore" : "Alessandro",
"Name" : "03) Configurazione integrato USB FTDI",
"Result" : 0,
"StartDate" : "2022-03-11T16:14:42.3746145 01:00",
"EndDate" : "2022-03-11T16:14:43.6001675 01:00"
}
}
}
POCO
public class Log
{
public string Guid { get; set; }
public string SerialNumber { get; set; }
public int RecordType { get; set; }
public string Operatore { get; set; }
public string Name { get; set; }
public int Result { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
}
now my task is to search a document by Guid and so this is what i wrote in my client application just to test:
public partial class MainWindow : Window
{
ElasticClient? client = new ElasticClient();
ConnectionSettings? settings = new ConnectionSettings(new Uri("https://elk.xyz.to:9200")).DefaultMappingFor<Log>(i=>i.IndexName("testing_devices"))
.DefaultIndex("testing_devices")
.ApiKeyAuthentication("xxx", "yyy");
public MainWindow()
{
InitializeComponent();
client = new ElasticClient(settings);
var result = client.Search<Log>(s => s.Index("testing_devices").Query(q => q.Match(m => m.Field(f => f.Guid).Query("d8bb9004-7cb1-4594-8c93-80135a8b736c"))));
}
}
but no results are coming out of my query,it clearly say zero hits, as I already read a lot, without being able to produce any significant steps in order to achieve my goals, please can someone point me to the right direction?
EDIT: I'm adding the INDEX Definition for further investigations: