Span queries

I want to perform span query on different field.
Use case is like this, i have firstname and lastname indexed and i want to perform fuzzy search first on firstname and then lastname.

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.

Using fuzzy parameter in the match query should work well unless I don't understand the exact use case in which case providing an example is helpful.

I have user mappings as follow-
{
"mappings":{
"viewer":{
"properties":{
"type":{
"type":"text"
},
"first_name":{
"type":"text"
},
"last_name":{
"type":"text"
},
"email":{
"type":"keyword"
}
}
}
},
"settings":{
"analysis":{
"analyzer":{
"default":{
"type":"standard"
}
}
}
}
}

Now i want to perform fuzzy search on first_name and last_name, term query on email.
Suppose if user types "Chris Pitt", then i want to do fuzzy match chris on first_name and pitt on last_name, but if the input is only "chris" then i will only go for first_name fuzzy match and term email query.

Please format your code using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

Please edit your post.

And provide a script we can fully run to reproduce what you are asking for.

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