# Multi-word, multi-field search with analyzers

**URL:** https://discuss.elastic.co/t/multi-word-multi-field-search-with-analyzers/20061
**Category:** Elasticsearch
**Created:** [October 3, 2014, 9:15am UTC](https://discuss.elastic.co/t/multi-word-multi-field-search-with-analyzers/20061 "2014-10-03T09:15:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Senki](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Senki](https://discuss.elastic.co/u/Senki)
#### Post date: [October 3, 2014, 9:15am UTC](https://discuss.elastic.co/t/multi-word-multi-field-search-with-analyzers/20061/1 "2014-10-03T09:15:23Z")

</div>

Hi!

I want to use elasticsearch for multi-word searches, where all the fields  
are checked in a document with the assigned analyzers.

So if I have a mapping:

{  
"settings": {  
"analysis": {  
"analyzer": {  
"folding": {  
"tokenizer": "standard",  
"filter": ["lowercase", "asciifolding"]  
}  
}  
}  
},  
"mappings" : {  
"typeName" :{  
"date\_detection": false,  
"properties" : {  
"stringfield" : {  
"type" : "string",  
"index" : "folding"  
},  
"numberfield" : {  
"type" : "multi\_field",  
"fields" : {  
"numberfield" : {"type" : "double"},  
"untouched" : {"type" : "string", "index" : "not\_analyzed"}  
}  
},  
"datefield" : {  
"type" : "multi\_field",  
"fields" : {  
"datefield" : {"type" : "date", "format":  
"dd/MM/yyyy||yyyy-MM-dd"},  
"untouched" : {"type" : "string", "index" : "not\_analyzed"}  
}  
}  
}  
}  
}  
}  
}

As you see I have different types of fields, but I do know the structure.  
What I want to do is starting a search with a string to check all fields  
using the analyzers too.

For example if the query string is:

John Smith 2014-10-02 300.00

I want to search for "John", "Smith", "2014-10-02" and "300.00" in all the  
fields, calculating the relevance score as well. The better solution is the  
one that have more field matches in a single document.

So far I was able to search in all the fields by using multi\_field, but in  
that case I was not able to parse 300.00, since 300 was stored in the  
string part of multi\_field.  
If I was searching in "\_all" field, then no analyzer was used.

How should I modify my mapping or my queries to be able to do a multi-word  
search, where dates and numbers are recognized in the multi-word query  
string?  
Now when I do a search, error occurs, since the whole string cannot be  
parsed as a number or a date. And if I use the string representation of the  
multi\_search then 300.00 will not be a result, since the string  
representation is 300.

(what I would like is similar to google search, where dates, numbers and  
strings are recognized in a multi-word query)

Any ideas?

Thanks!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/91ccbb0f-ccdf-4846-b8c5-ddf4005207b7%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/91ccbb0f-ccdf-4846-b8c5-ddf4005207b7%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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: [July 6, 2017, 12:58am UTC](https://discuss.elastic.co/t/multi-word-multi-field-search-with-analyzers/20061/2 "2017-07-06T00:58:28Z")

</div>


