相似的Termquerys,但不相似的输出..有什么区别?

时间:2018-08-23 15:07:51

标签: c# elasticsearch nest

我对此有疑问。第一个可以完美运行IMO,

QueryContainer query = new TermQuery()
        {
            Field = "OrderId",
            Value = "1"
        };
        var searchRequest = new SearchRequest(index: "testindex")
        {
            Query = query
        };
        var searchResult = client.Search<TestLogs>(searchRequest);
  var orderIdArray = searchResult.Documents.ToArray();

  Console.WriteLine(orderIdArray[0])

  foreach (var s in orderIdArray)
        {

            Console.WriteLine($"{i}:    OrderId:" + s.OrderID + " Event: " + s.Event + " Time: " + s.TimeStamp);
            i++;
        }

现在只有在我更改时才是问题

 QueryContainer query = new TermQuery()
        {
            Field = "OrderId",
            Value = "1"
        }; 

到...

 QueryContainer query = new TermQuery()
        {
            Field = "Event",
            Value = "CreateOrder"
        };

在Test方法中不会提供任何输出

  

ELK_algorithmsTests.TestIndexCreation.testToMakeSameSelectionButWithSelectedEvent   引发异常:System.IndexOutOfRangeException:..

通过查看基巴纳语,我可以阅读 {         “ _index”:“ testindex”,         “ _type”:“日志”,         “ _id”:“ 5”,         “ _score”:1         “_资源”: {           “ OrderId”:“ 2”,           “ Event”:“ StartOrder”,           “时间戳记”:“ 2018-01-01 02:27:00”         }       }

应该在哪里找到任何建议?因为我现在没主意了...

0 个答案:

没有答案