# Search multifield using cross\_fields with one untokenizer field

**URL:** <https://discuss.elastic.co/t/search-multifield-using-cross-fields-with-one-untokenizer-field/160232>\
**Category:** Elasticsearch\
**Created:** [December 10, 2018, 6:09pm UTC](https://discuss.elastic.co/t/search-multifield-using-cross-fields-with-one-untokenizer-field/160232 "2018-12-10T18:09:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Claudio\_Ranieri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/claudio_ranieri/32/25393_2.png) [@Claudio\_Ranieri](https://discuss.elastic.co/u/Claudio_Ranieri)\
**Post date:** [December 10, 2018, 6:09pm UTC](https://discuss.elastic.co/t/search-multifield-using-cross-fields-with-one-untokenizer-field/160232/1 "2018-12-10T18:09:34Z")

</div>

Hi,  
Our system is based on searching on multiple fields, such as: category, spec, name of product, among others. This way we can adjust our relevance by boost on field. The users can search for "tv 60 inches". In this case the term "tv" is a category and the terms "60 inches" is a spec. We would like the terms of the spec be untokenizer (the queryString of the user must contain all the terms of the spec for the document to be returned). The problem is that by using cross\_fields with a untokenizer field, the document is not found.  
Example:

// Create index  
PUT test\_multi  
{  
"settings": {  
"analysis": {  
"analyzer": {  
"my\_text": {  
"tokenizer": "standard",  
"filter": [  
"lowercase",  
"asciifolding"  
]  
},  
"my\_text\_kw": {  
"tokenizer": "keyword",  
"filter": [  
"lowercase",  
"asciifolding"  
]  
}  
}  
}  
},  
"mappings": {  
"product": {  
"properties": {  
"category": {  
"type": "text",  
"analyzer": "my\_text"  
},  
"spec": {  
"type": "text",  
"analyzer": "my\_text\_kw"  
}  
}  
}  
}  
}

// Add document 1  
PUT test\_multi/doc/1  
{  
"category": "TV",  
"spec": "60 inches"  
}

// Add document 2  
PUT test\_multi/doc/2  
{  
"category": "TV",  
"spec": "60 Hz"  
}

// Search  
GET test\_multi/\_search  
{  
"query": {  
"multi\_match": {  
"query": "tv 60 inches",  
"type": "cross\_fields",  
"operator": "and",  
"fields": [  
"category","spec"  
]  
}  
}  
}

We do not want to use the spec field with tokenizer standard, because some isolated terms in the spec could be found. We also do not want to create a field unifying all the fields, since we have several fields and we want to control the boost by field to adjust our relevance. Is there any way to use cross field with a untokenizer field?

---

<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:** [January 7, 2019, 6:09pm UTC](https://discuss.elastic.co/t/search-multifield-using-cross-fields-with-one-untokenizer-field/160232/2 "2019-01-07T18:09:37Z")

</div>

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