.NET - Wildcard deprecated, alternative?

Hi there,

I just upgraded our 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

Answered this issue on the github repo, posting here for posterity.

Hey @Schoof,

that particular method call for WildCard() was deprecated in NEST 5.3.0 because of #2688.

It's easily resolved by specifying rewrite though

(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.

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