Hi!
Im pretty new to ES and got a little problem,
This one works as it should.
public void testCreateIndexBasedOnSelectedOrderId()
{
var pool = new SingleNodeConnectionPool(new Uri(uri));
var settings = new ConnectionSettings(pool).DisableDirectStreaming();
var client = new ElasticClient(settings);
QueryContainer query = new TermQuery()
{
Field = "OrderId",
Value = "1"
};
var searchRequest = new SearchRequest(index: "testindex")
{
Query = query
};
var searchResult = client.Search<TestLogs>(searchRequest);
Console.WriteLine(searchResult);
Console.WriteLine("searchResponse.Documents.Count: " + searchResult.Documents.Count());
Console.WriteLine("Checking Fields Values: " + searchResult.Fields.Count());
Console.WriteLine("Checking Hits Values: " + searchResult.Hits.Count());
var orderIdArray = searchResult.Documents.ToArray();
Console.WriteLine(orderIdArray[0]);
var i = 0;
foreach (var s in orderIdArray)
{
Console.WriteLine($"{i}: OrderId:" + s.OrderID + " Event: " + s.Event + " Time: " + s.TimeStamp);
i++;
}
Assert.AreNotEqual(orderIdArray, null);
}
But once i change the
QueryContainer query = new TermsQuery()
{
Field = "Event",
Value = "CreateOrder" <--- is the event, can be compared to previous number 2 ,
};
var searchRequest = new SearchRequest(index: "testindex")
{
Query = query
};
var searchResult = client.Search<TestLogs>(searchRequest);
but this time it wont give some output at all
output is:
Test method ELK_algorithmsTests.TestIndexCreation.testToMakeSameSelectionButWithSelectedEvent threw exception:
System.IndexOutOfRangeException: Indexet låg utanför gränserna för matrisen.
vid ELK_algorithmsTests.TestIndexCreation.testToMakeSameSelectionButWithSelectedEvent() i
Valid NEST response built from a successful low level call on POST: /testindex/_search?typed_keys=true
searchResponse.Documents.Count: 0
Checking Fields Values: 0
Checking Hits Values: 0
My question is more.. what did i miss here? any suggestions?