# Autocomplete and searching against multiple term fields

**URL:** https://discuss.elastic.co/t/autocomplete-and-searching-against-multiple-term-fields/11556
**Category:** Elasticsearch
**Created:** [April 12, 2013, 2:57am UTC](https://discuss.elastic.co/t/autocomplete-and-searching-against-multiple-term-fields/11556 "2013-04-12T02:57:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![troy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/troy/32/2547_2.png) [@troy](https://discuss.elastic.co/u/troy)
#### Post date: [April 12, 2013, 2:57am UTC](https://discuss.elastic.co/t/autocomplete-and-searching-against-multiple-term-fields/11556/1 "2013-04-12T02:57:31Z")

</div>

I'm integrating elasticsearch into an asset tracking application. When I  
setup the mapping initially, I envisioned the 'brand' field being a  
single-term field like 'Hitachi', or 'Ford'. Instead, I'm finding that the  
brand field in the actual data contains multiple terms like: "MB 7 A/B",  
"B-7" or even "Brush Bull BB72X".

I have an autocomplete component setup now that I configured to do  
autocomplete against an edgeNGram field, and perform the actual search  
against an nGram field. It's completely useless the way I set it up because  
users expect the search results to be restricted to what the autocomplete  
matches.

Any suggestions on the best way to setup my mapping to support autocomplete  
and subsequent searches against a multiple term field like this? I'm  
considering a terms query against a keyword field, or possibly a match  
query with 'and' as the operator? Also, anything special I need to do to  
search against terms with a hyphen in them like "B-7"?

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:41am UTC](https://discuss.elastic.co/t/autocomplete-and-searching-against-multiple-term-fields/11556/2 "2017-07-06T02:41:28Z")

</div>


