# Search returning no results after upgrade from 7.9.3 to 7.15.0

**URL:** <https://discuss.elastic.co/t/search-returning-no-results-after-upgrade-from-7-9-3-to-7-15-0/286739>\
**Category:** Elasticsearch\
**Created:** [October 14, 2021, 2:36pm UTC](https://discuss.elastic.co/t/search-returning-no-results-after-upgrade-from-7-9-3-to-7-15-0/286739 "2021-10-14T14:36:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![williamhbell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/williamhbell/32/95894_2.png) [@williamhbell](https://discuss.elastic.co/u/williamhbell)\
**Post date:** [October 14, 2021, 2:36pm UTC](https://discuss.elastic.co/t/search-returning-no-results-after-upgrade-from-7-9-3-to-7-15-0/286739/1 "2021-10-14T14:36:32Z")

</div>

Hi,

Our Elasticsearch installation was recently updated from 7.9.3 to 7.15.0. (The host operating system was updated from Ubuntu LTS 18 to 20 at the same time.) Following this update, the search scripts and programs were corrected to address deprecation warnings. Documents can be inserted and retrieved successfully, but the wildcard search functionality no longer works with 7.15.0. Looking at the search scripts:

- One script uses a wildcard following the instructions at [Wildcard query | Elasticsearch Guide [7.15] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html) , but no longer returns results. Changing the script to use regexp has no effect and no results are returned.
- Scripts and programs that use the following combinations {"query" and "range"}, {"query", "bool", "must" and"match"} still work.

Is some server configuration needed to cause the wildcard search to start working again? The configuration file `/etc/elasticsearch/elasticsearch.yml` was updated to explicitly include `search.allow_expensive_queries: true` but this has no effect.

Thanks,

Will

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 14, 2021, 2:55pm UTC](https://discuss.elastic.co/t/search-returning-no-results-after-upgrade-from-7-9-3-to-7-15-0/286739/2 "2021-10-14T14:55:00Z")

</div>

Hi William,

> [@williamhbell](#):
>
> the wildcard search functionality no longer works with 7.15.0.

It's possible that it wasn't working (correctly) in 7.9 and works correctly now in 7.15.  
By that I mean you may have been relying on a "false positive" bug in matching.

I recently catalogued the matching behaviour of all queries on all field types with all case-sensitivity options across multiple versions and stored the match correctness results in [this gist](https://gist.github.com/markharwood/da3bdb5312e76ed946976e3d98d3b2b8).

This test result from 7.9.0 is an example of a false positive bug:

```auto
{"version": "7.9.0", "queryType": "wildcard", "fieldType": "text", "query": "{\"wildcard\": {\"s.text\": {\"value\": \"*ALLUPPER*\"}}}", "result": "FP"}

```

An uppercase wildcard query term on a lower-cased text field should never have matched.  
This was rectified in a later version to return nothing,  
If you want the case insensitive matching behaviour back the wildcard and regexp queries now have ` case_insensitive` parameter which you can set to true.

---

<div class="post-metadata">

**Author:** ![williamhbell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/williamhbell/32/95894_2.png) [@williamhbell](https://discuss.elastic.co/u/williamhbell)\
**Post date:** [October 14, 2021, 3:53pm UTC](https://discuss.elastic.co/t/search-returning-no-results-after-upgrade-from-7-9-3-to-7-15-0/286739/3 "2021-10-14T15:53:59Z")

</div>

Hi Mark,

Thanks for your message. Constructing a simple example to illustrate the point:

```auto
curl -X POST "http://localhost:9200/names/_doc/1?pretty" -H 'Content-Type: application/json' -d'
{
    "name" : "One name"
}
'

```

returns

```auto
{
  "_index" : "names",
  "_type" : "_doc",
  "_id" : "1",
  "_version" : 1,
  "result" : "created",
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  },
  "_seq_no" : 0,
  "_primary_term" : 1
}

```

```auto
curl -X POST "http://localhost:9200/names/_doc/2?pretty" -H 'Content-Type: application/json' -d'
{
    "name" : "Another name"
}
'

```

returns

```auto
{
  "_index" : "names",
  "_type" : "_doc",
  "_id" : "2",
  "_version" : 1,
  "result" : "created",
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  },
  "_seq_no" : 1,
  "_primary_term" : 1
}

```

Running a wildcard search:

```auto
curl -X GET "http://localhost:9200/names/_search?pretty" -H 'Content-Type: application/json' -d'
{
  "query": {
    "wildcard": {
      "name": {
        "value": "Ano*"
      }
    }
  }
}
'

```

returns

```auto
{
  "took" : 59,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : []
  }
}

```

whereas changing the wildcard query to be:

```auto
curl -X GET "http://localhost:9200/names/_search?pretty" -H 'Content-Type: application/json' -d'
{
  "query": {
    "wildcard": {
      "name": {
        "value": "*"
      }
    }
  }
}
'

```

returns both documents as expected.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 14, 2021, 4:01pm UTC](https://discuss.elastic.co/t/search-returning-no-results-after-upgrade-from-7-9-3-to-7-15-0/286739/4 "2021-10-14T16:01:13Z")

</div>

So my comment about case insensitivity still stands.  
Try

```auto
curl -X GET "http://localhost:9200/names/_search?pretty" -H 'Content-Type: application/json' -d'
{
  "query": {
    "wildcard": {
      "name": {
        "value": "ano*"
      }
    }
  }
}

```

or

```auto
curl -X GET "http://localhost:9200/names/_search?pretty" -H 'Content-Type: application/json' -d'
{
  "query": {
    "wildcard": {
      "name": {
        "value": "Ano*",
        "case_insensitive": true
      }
    }
  }
}
'

```

---

<div class="post-metadata">

**Author:** ![williamhbell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/williamhbell/32/95894_2.png) [@williamhbell](https://discuss.elastic.co/u/williamhbell)\
**Post date:** [October 14, 2021, 4:19pm UTC](https://discuss.elastic.co/t/search-returning-no-results-after-upgrade-from-7-9-3-to-7-15-0/286739/5 "2021-10-14T16:19:44Z")

</div>

Both of your queries returned one document:

```auto
{
  "took" : 99,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "names",
        "_type" : "_doc",
        "_id" : "2",
        "_score" : 1.0,
        "_source" : {
          "name" : "Another name"
        }
      }
    ]
  }
}

```

With version 7.9.3, the value was allowed to be `"Ano*"` without the `"case_insensitive": true`. I will change the other wildcard queries to be case insensitive. Thanks for your help.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 14, 2021, 4:57pm UTC](https://discuss.elastic.co/t/search-returning-no-results-after-upgrade-from-7-9-3-to-7-15-0/286739/6 "2021-10-14T16:57:33Z")

</div>

Glad it worked out for you.

---

<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:** [November 11, 2021, 4:57pm UTC](https://discuss.elastic.co/t/search-returning-no-results-after-upgrade-from-7-9-3-to-7-15-0/286739/7 "2021-11-11T16:57:39Z")

</div>

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