- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.2k
Closed as not planned
Labels
Description
Elastic.Clients.Elasticsearch version:
8.16.3
Elasticsearch version:
8.6.1
.NET runtime version:
.net9
Description of the problem including expected versus actual behavior:
I am trying to deserialize the following query:
{
  "query": {
    "term": { "Content.ContentItem.ContentType": "BlogPost" }
  },
  "size": 3
}This query string is being deserialized using the SourceSerializer like this:
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(query));
var request = _client.SourceSerializer.Deserialize<SearchRequest>(stream);However, the code above fails to deserialize the value of the term query when it is provided as a string.
The following query works as expected:
{
  "query": {
    "term": { "Content.ContentItem.ContentType": { "value": "BlogPost" } }
  },
  "size": 3
}Steps to reproduce:
- Try to deserialize the query listed above using the code.
Expected behavior
I expect that the value will be deserialize from a string or from an object.