I have only one document in my ElasticSearch index with Events_Id == 986147
+---------+---------+---------+----------------+-------+---------+-------------+
|Animal_Id|EventName|Events_Id|Extras |Farm_Id|Farmer_Id|Time |
+---------+---------+---------+----------------+-------+---------+-------------+
|126248 |Abortion |986147 |[null,null,null]|5095 |-1 |1419634800000|
+---------+---------+---------+----------------+-------+---------+-------------+
but when I execute in C#:
var r1 = client.Search<Nesting>(new
{
Query = new TermQuery {Field = "Events_Id", Value = "986147"}
});
I got 3x instances
where first two don't exist in ES (they have totaly new value for parameter Time):
Nesting(Events_Id:986147, Animal_Id:126248, Farm_Id:5095, Time:1420473746707, EventName:Abortion, Farmer_Id:-1, Extras:)
Nesting(Events_Id:986147, Animal_Id:126248, Farm_Id:5095, Time:1420473746707, EventName:Abortion, Farmer_Id:-1, Extras:)
Nesting(Events_Id:986147, Animal_Id:126248, Farm_Id:5095, Time:1419634800000, EventName:Abortion, Farmer_Id:-1, Extras:From_Stall_Id:, To_Stall_Id:, HoldingPen_Id:)
My schema looks like:
root
|-- Animal_Id: long (nullable = true)
|-- EventName: string (nullable = true)
|-- Events_Id: long (nullable = true)
|-- Extras: struct (nullable = true)
| |-- From_Stall_Id: long (nullable = true)
| |-- HoldingPen_Id: long (nullable = true)
| |-- To_Stall_Id: long (nullable = true)
|-- Farm_Id: long (nullable = true)
|-- Farmer_Id: long (nullable = true)
|-- Time: long (nullable = true)
and C# classes:
class NestedExtras
{
long? From_Stall_Id { get; set; }
long? To_Stall_Id { get; set; }
long? HoldingPen_Id { get; set; }
}
class Nesting
{
long? Events_Id { get; set; }
long? Animal_Id { get; set; }
long? Farm_Id { get; set; }
long? Time { get; set; }
string EventName { get; set; }
long? Farmer_Id { get; set; }
NestedExtras Extras { get; set; }
}
I have tested with HTTP-API and SPARK-ES and they return only one document so I must be something missing about C#/NEST nullable or something like that?