Multi field search with wildcard expression in query

Expecting text "abc" search against field1 or field2 to get the results.
what is wrong in below query?
s => s
.Query(q => q
.DisMax(d => d
.Queries(q1 => q1
.Wildcard(w => w
.Field(f => f.field1).Value("abc*")
.Field(f => f.field2).Value("abc*")

tried this as well:

s => s
.Query(q => q
.Bool(d => d
.Must(q1 => q1
.Wildcard(w => w
.Field(f1 => f1.field1).Value("abc*")
.Field(f => f.field2).Value("abc*")

its working only for field2 search.

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script is something anyone can copy and paste in Kibana dev console, click on the run button to reproduce your use case. It will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

Thank you for your response.

I am new to Elasticsearch, i have installed elasticsearch and logstash in my machine.
i have pushed data to elastic search.

Using Nest elastic client i am searching data in elasticsearch data.

My requirement is i want to do like search against two columns.

Using below client query i am able to search data in one column (column name is accno).

var searchResult = client.Search(s => s
.Query(q => q
.Wildcard(m => m
.Field(f => f.Accno)

Now i want to search value "TS18*" against accno and reqno fields. I am unable to write
single query to search in two fields.

Thank you for your help.

Have a look at the link I shared. I can't help without a minimal set of information.
I don't write dotNet code so using Kibana dev console would help.

hope this helps for you to understand my issue.
GET index_name/_search
"query": {
"wildcard": {
"foo": "bar*"

foo and foo1 are the fields in my index.
now i want to search "bar*" in foo, foo1 fields.
how to write query to search the same value in two fields?

Use the multi_match query or a bool query with a should array with two wildcard queries.
But I'd not use wildcards unless I don't care of the response time.

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