Skip to content

Count Generating Wrong Query #346

Closed
Closed
@nariman-haghighi

Description

@nariman-haghighi
ICountResponse response = new ElasticClient(SearchSettings).Count<MediaStreamEntry>(
    new[] { "StreamEntry" }, 
    x => x.Bool(
        b => b.Must(x.Term(f => f.StreamId, streamId.ToString())
        , x.Term(f => f.ApprovalSettings.Approved, approved)
    )));                                                                                                                                           

Is generating:

{
  "term": {
    "approval_settings.approved": {
      "value": true
    }
  },
  "bool": {
    "must": [
      {
        "term": {
          "stream_id": {
            "value": "8d00cf65-bf84-4035-9adb-695b1366304c"
          }
        }
      },
      {
        "term": {
          "approval_settings.approved": {
            "value": true
          }
        }
      }
    ]
  }
}

When the expected result is just the bool query with the two terms.

This is on the latest version... any workarounds?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions