Nested search works not as expected

Hello,

I have the following documents

[
  {
    "id": "Car#1",
    "accessories": [
      {
        "type": "Turbo",
        "price": 20
      },
      {
        "type": "Supercharger",
        "price": 30
      }
    ]
  },
  {
    "id": "Car#2",
    "accessories": [
      {
        "type": "Turbo",
        "price": 20
      }
    ]
  },
  {
    "id": "Car#3",
    "accessories": [
      {
        "type": "Supercharger",
        "price": 30
      }
    ]
  },
  {
    "id": "Car#4",
    "accessories": [
      {
        "type": "Turbo",
        "price": 10
      },
      {
        "type": "Supercharger",
        "price": 30
      }
    ]
  }
]

(accessories are nested)

I am trying to write a query that returns all cars that have "Supercharger" with price: 30 when "Turbo" is not price 20

The result given the test dataset should be: "Car#4", "Car#3"

These will not be included:
("Car#2" does not have "Supercharger", "Car#1" has "Supercharger" however Turbo price is 20 and does not count)

  1. Is this query possible?
  2. Can you give an example query which works? I have tried for 2 weeks now and can't think of anything?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.