# Issues with new search query

**URL:** <https://discuss.elastic.co/t/issues-with-new-search-query/313804>\
**Category:** Elasticsearch\
**Created:** [September 6, 2022, 2:21pm UTC](https://discuss.elastic.co/t/issues-with-new-search-query/313804 "2022-09-06T14:21:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rzaal](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@rzaal](https://discuss.elastic.co/u/rzaal)\
**Post date:** [September 6, 2022, 2:21pm UTC](https://discuss.elastic.co/t/issues-with-new-search-query/313804/1 "2022-09-06T14:21:38Z")

</div>

Hi i have recently been busy reworking our old and outdated ES now um running 8.4 and im trying to create a similar query to what i had in the old one. But i have a hard time finding examples or the right documentation

This is an example what we had:

```auto
{
  "index": "vehicles",
  "type": "vehicle",
  "body": {
    "from": "0",
    "size": 30,
    "query": {
      "filtered": {
        "query": { "match_all": [] },
        "filter": {
          "bool": {
            "must": [
              {
                "bool": {
                  "should": [
                    [
                      { "term": { "make.untouched": "IVECO" } },
                      { "term": { "make.untouched": "VOLKSWAGEN" } }
                    ]
                  ]
                }
              },
              {
                "bool": {
                  "should": [[{ "term": { "type_serie.untouched": "DAILY" } }]]
                }
              },
              {
                "bool": {
                  "should": [[{ "term": { "filters.header.camper": "true" } }]]
                }
              },
              { "range": { "days_sold": { "gte": 0, "lt": 2 } } },
              { "range": { "days_on_stock": { "gte": 3 } } },
              { "range": { "price": { "gt": 0 } } },
              { "range": { "price_trader": { "gt": 0 } } },
              { "term": { "show_in_search": true } }
            ],
            "must_not": [
              { "term": { "offer_code": "z" } },
              { "term": { "stockingtype": "a" } },
              { "term": { "stockingtype": "v" } },
              { "term": { "stockingtype": "z" } },
              { "term": { "stockingtype": "p" } }
            ]
          }
        }
      }
    },
    "sort": [
      { "_score": "desc" },
      { "days_on_stock": "asc" },
      { "price": "asc" }
    ]
  }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 4, 2022, 2:22pm UTC](https://discuss.elastic.co/t/issues-with-new-search-query/313804/2 "2022-10-04T14:22:11Z")

</div>

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