One of the fields in my elastic index is always deserialized as null by Nest. The index I am using has the following structure:
"myIndex": {
"myMapping": {
"name": {default properties},
"guid": {"type": "keyword"},
"myDisabledField": {
"type": "object",
"enabled": false
}
}
}
When I try a search against this index using Nest 6.x, it always returns "myDisabledField" as null. However, if I make the same request in kibana it shows "myDisabledField" in the _source. For example, the kibana query:
GET myIndex/_search
{
"query": {
"query_string": {
"query": "sample query"
}
}
}
would return the following:
{
"hits": [
{
"_index": "myIndex",
"_source": {
"name": "some_name",
"guid": "some_guid",
"myDisabledField": {
"field1": "value1",
"field2": "value2",
... etc
}
}
}
]
}
However, the C#/Nest query:
var result = _elasticClient.Search<T>(
s => s
.Query(
q => q
.QueryString(
qs => qs
.Query("sample query")
)
)
);
return result.Documents.ToList();
Returns something like:
[
"MyObject": {
"Name": "some_name",
"Guid": "some_guid",
"MyDisabledField": null
}
]
"MyObject" in this case is the POCO that I used to populate this index. How do I get Nest to fill "MyDisabledField" with the data stored in the _source? Is there some sort of setting needed to deserialize objects, or fields with the setting enabled=false?
By the way I used the DefaultMappingFor connection setting to map to the correct index for my type. This is the documentation on the enabled property I used