0

There have a doc with the day_count like :

"day_count": [
        {
          "user_count": 2,
          "count": 9,
          "start": "2025-08-04 00:00:00",
          "end": "2025-08-04 23:59:59",
          "day": "2025-08-04"
        },
        {
          "user_count": 2,
          "count": 10,
          "start": "2025-08-04 00:00:00",
          "end": "2025-08-05 23:59:59",
          "day": "2025-08-042025-08-05"
        },
        {
          "user_count": 0,
          "count": 1,
          "start": "2025-08-05 00:00:00",
          "end": "2025-08-05 23:59:59",
          "day": "2025-08-05"
        }
      ]

then I want filter like sql : day_count.user_count>=1 and day_count.day="2025-08-05" will not return this doc ,because day_count.day="2025-08-05" is the third item ,but user_count is equal 0, not >=1

and the query dsl like below with will return this doc:

"filter": [
    {
      "bool": {
        "must": [
          {
            "range": {
              "day_count.user_count": {
                "gte": 1
              }
            }
          },
          {
            "term": {
              "day_count.day": "2025-08-05"
            }
          }
        ]
      }
    }
  ]

so how to write this filter statement to exclude this doc

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.