Query data from C# program the result not equal to the data filter from kibana

I am new to C#, and I want to write a program to query data from elasticsearch.
First of all, I load kibana sample log and want to query from my C# program, and below is my C# program. I want to filter clientip is 20.102.50.96 logs.

class Program
    {
        static void Main(string[] args)
        {
            var settings = new ConnectionSettings(new Uri("http://127.0.0.1:9200"))
            .DefaultIndex("kibana_sample_data_logs");
            var client = new ElasticClient(settings);

            var searchResponse = client.Search<SampleLog>(s => s
            .From(0)
            .Size(10)
            .Query(q => q
                 .Match(m => m
                    .Field(f => f.clientip)
                    .Query("20.102.50.96")
                  )
                )
            );
            var logs = searchResponse.Documents;
            foreach(SampleLog p in logs)
            {
                Console.WriteLine(p.bytes);
                Console.WriteLine(p.url);
                Console.WriteLine(p.clientip);
                Console.WriteLine(p.message);

            }
            Console.WriteLine(logs.Count);
        }
    }

I am confused that if my log has 40 fields, and do I need initialize 40 var such as below?
Does it affect the result data?

public class SampleLog
    {
        public string extension { get; set; }
        public string clientip { get; set; }
        public string message { get; set; }
        public string url { get; set; }
        public int bytes { get; set; }
    }

when I run my code, the result has 10 logs:


However, I can't find so many logs from kibana, and there are only two logs:

thanks a lot !

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.