# .NET - Wildcard deprecated, alternative?

**URL:** <https://discuss.elastic.co/t/net-wildcard-deprecated-alternative/93128>\
**Category:** Elasticsearch\
**Created:** [July 14, 2017, 6:47am UTC](https://discuss.elastic.co/t/net-wildcard-deprecated-alternative/93128 "2017-07-14T06:47:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon99430464](https://avatars.discourse-cdn.com/v4/letter/a/a587f6/32.png) [@anon99430464](https://discuss.elastic.co/u/anon99430464)\
**Post date:** [July 14, 2017, 6:47am UTC](https://discuss.elastic.co/t/net-wildcard-deprecated-alternative/93128/1 "2017-07-14T06:47:25Z")

</div>

Hi there,

I just upgraded our [Elasicsearch.NET](http://Elasicsearch.NET) and NEST to 5.4 (from 5.2.2). After doing this some code doesn't work any more. Specifically the .Wildcard on a QueryContainer. I had the following code:

> ```
> var query = value.Contains("*") ? (Func<QueryContainerDescriptor<T>, QueryContainer>)
> (bs => bs.Wildcard(propConfig.KeySelector, value)) : // wildcard search
> (bs => bs.Term(propConfig.KeySelector, value)); // default term search
> 
> ```

On the bs.Wildcard I get the exception:

> The call is ambiguous between the following methods or properties: 'QueryContainerDescriptor.Wildcard(Expression\<Func\<T, object\>\>, string, double?, RewriteMultiTerm?, string)' and 'QueryContainerDescriptor.Wildcard(Expression\<Func\<T, object\>\>, string, double?, MultiTermQueryRewrite, string)'

However I also noticed Wilcard is now deprecated. I however can't find any documentation about this.  
What is the suggested query to use now instead of Wildcard if it is actually deprecated?

Thank you,  
Schoof

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [July 21, 2017, 8:28am UTC](https://discuss.elastic.co/t/net-wildcard-deprecated-alternative/93128/2 "2017-07-21T08:28:47Z")

</div>

Answered this [issue on the github repo](https://github.com/elastic/elasticsearch-net/issues/2805), posting here for posterity.

Hey @anon99430464,

that particular method call for `WildCard()` was deprecated in [NEST 5.3.0](https://github.com/elastic/elasticsearch-net/releases/tag/5.3.0) because of [#2688](https://github.com/elastic/elasticsearch-net/issues/2688).

It's easily resolved by specifying `rewrite` though

```auto
(bs => bs.Wildcard(propConfig.KeySelector, value, rewrite:(MultiTermQueryRewrite)null))

```

The deprecated methods will be removed in the next major release so this won't flag there.

---

<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:** [August 18, 2017, 8:29am UTC](https://discuss.elastic.co/t/net-wildcard-deprecated-alternative/93128/3 "2017-08-18T08:29:09Z")

</div>

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