# Understanding cross\_fields and "AND" operator

**URL:** <https://discuss.elastic.co/t/understanding-cross-fields-and-and-operator/53917>\
**Category:** Elasticsearch\
**Created:** [June 24, 2016, 6:23pm UTC](https://discuss.elastic.co/t/understanding-cross-fields-and-and-operator/53917 "2016-06-24T18:23:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![midget2000x](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@midget2000x](https://discuss.elastic.co/u/midget2000x)\
**Post date:** [June 24, 2016, 6:23pm UTC](https://discuss.elastic.co/t/understanding-cross-fields-and-and-operator/53917/1 "2016-06-24T18:23:42Z")

</div>

I'm honing on a default search query for a client's commerce site. It's looking like a cross\_fields multi\_match with "AND" operator is producing the most relevant results (at least to me, in testing).

However, I am trying to understand why some "AND" queries _don't_ match. For example, I want customer to be able to enter their name and the product they wish to order like "brennan shot glass". "shot" and "glass" will match on name, and "brennan" will match on options\_description (a list of names).

since cross\_fields treats queried fields as "one big field", and I took care to index all the queried fields with the same analyzer...I cannot figure out for the life of my why this query returns no results:

`curl -XGET 'http://localhost:9200/shop/_search?&pretty=1&size=18' -d ' { "query" : { "multi_match" : { "operator" : "and", "fields" : ["name", "search_words", "description", "skuid", "backend_skuid", "options_descriptions"], "query" : "brennan shot glass", "type" : "cross_fields" } } } '`

the document that I want to match appears to have all the goods:

`"name" : "Personalized Shot Glass", "options_descriptions" : "Name Boyle Brady Brennan Burke Byrne Callahan Carroll Casey Clarke Collins Connolly Cullen Daly Doherty Donnelly Donovan Doyle Duffy Dunne Farrell Fitzgerald Fitzpatrick Flanagan Flynn Foley Gallagher Griffin Hayes Healy Higgins Hogan Kavnaugh Kelly Kennedy Lynch Maguire Mahony Maloney Martin McCarthy McDermott McGrath McMahon Moore Moran Murphy Murray NolanO'Brien O'Connell O'Connor O'Donnell O'Leary O'Mara O'Neill O'Reilly O'Shea O'Sullivan Power Quinn(Clare) Regan Shanahan Sweeney Walsh"`

(I ran those strings thru the analyzer and the outputted tokens appear all correct to me..."brennan", "shot" and "glass" are all tokens)

I changed the operator to "OR" and that document does get returned, but along with many other less relevant items like "glass nightlight". Which is why I don't really want to use "OR" in general.

( also can't figure out how to preformat text on this forum, I am pasting the code between backticks but it's still showing up weird!)

---

<div class="post-metadata">

**Author:** ![klara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/klara/32/18440_2.png) [@klara](https://discuss.elastic.co/u/klara)\
**Post date:** [June 28, 2017, 1:12pm UTC](https://discuss.elastic.co/t/understanding-cross-fields-and-and-operator/53917/2 "2017-06-28T13:12:35Z")

</div>

I have the same issue, but my field's with different analyzers.

---

<div class="post-metadata">

**Author:** ![klara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/klara/32/18440_2.png) [@klara](https://discuss.elastic.co/u/klara)\
**Post date:** [June 28, 2017, 2:39pm UTC](https://discuss.elastic.co/t/understanding-cross-fields-and-and-operator/53917/3 "2017-06-28T14:39:00Z")

</div>

The query goes right. To use operator and for @tokens@ in multi\_match you must choose query string.

> <https://stackoverflow.com/questions/18114590/search-multiple-fields-with-and-operator-but-use-fields-own-analyzers>

---

<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:** [November 4, 2022, 4:23am UTC](https://discuss.elastic.co/t/understanding-cross-fields-and-and-operator/53917/4 "2022-11-04T04:23:31Z")

</div>


