# Find an Phrase with addtional variants

**URL:** https://discuss.elastic.co/t/find-an-phrase-with-addtional-variants/351067
**Category:** Elasticsearch
**Created:** [January 15, 2024, 12:19pm UTC](https://discuss.elastic.co/t/find-an-phrase-with-addtional-variants/351067 "2024-01-15T12:19:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![libertey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/libertey/32/126905_2.png) [@libertey](https://discuss.elastic.co/u/libertey)
#### Post date: [January 15, 2024, 12:19pm UTC](https://discuss.elastic.co/t/find-an-phrase-with-addtional-variants/351067/1 "2024-01-15T12:19:03Z")

</div>

Hello,

i run into a Problem with matching of queries, I have an `keyowrd` like **John Doe** and now my System should find all Entries where the **John Doe** is mentioned as `author`. The main Problem is the Person **John Doe** is not always written like that, he has some funny side names which are sometimes mentioned complete sometimes only mentioned with the initials, like that **PD Dr. med. dent. John H. M. Doe** with my actual query i cant find the name if the sidenames are mentioned, but i want to get all with the combination of the first and lastname.

My actual Query:

```auto
{
	"size": 9999,
	"query": {
			"bool": {
				"must": [
					{
						"multi_match": {
							"query": "John Doe",
							"type": "phrase",
							"fields": [
								"author.unstemmed"
							]
						}
					}
				]
			}
	}
}

```

`unstemmed` analyzer or field propertiy also my analyzerproperties:

```auto
"author": {
	"type": "text",
	"fields": {
		"unstemmed": {
			"type": "text",
			"analyzer": "standard_unstemmed"
		}
	},
	"analyzer": "standard_unstemmed"
},

```

```auto
...
"analyzer": {
	"standard": {
		"filter": [
			"lowercase",
			"german_stemmer",
			"synonym_filter"
		],
		"tokenizer": "standard"
	},
	"standard_unstemmed": {
		"filter": [
			"lowercase"
		],
		"tokenizer": "standard"
	}
},
...

```

If somebody could explain to me what i could change on the query or in the settings to get it done it would be awesome. Thanks!

---

<div class="post-metadata">

### Author: ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)
#### Post date: [January 15, 2024, 7:12pm UTC](https://discuss.elastic.co/t/find-an-phrase-with-addtional-variants/351067/2 "2024-01-15T19:12:01Z")

</div>

Hi @libertey

Have you tried combining another multimatch with the type best fields?

---

<div class="post-metadata">

### Author: ![libertey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/libertey/32/126905_2.png) [@libertey](https://discuss.elastic.co/u/libertey)
#### Post date: [January 17, 2024, 9:49am UTC](https://discuss.elastic.co/t/find-an-phrase-with-addtional-variants/351067/3 "2024-01-17T09:49:26Z")

</div>

Hey sorry for late replay was working on something else,

could you explain what you mean like another multimatch inside the must query?

I use now

```auto
{
	"query": {
			"bool": {
				"must": [
					{
						"multi_match": {
							"query": "John Doe",
							"type": "cross_fields",
							"fields": [
								"author.unstemmed"
							],
                                                        "operator": "and"
						}
					}
				]
			}
	}
}

```

With best\_fields i had the Problem that there were all People with the first name **John** and all with the lastname **doe**.

The cross\_field i understand like it oversees all in the given fields and looks up if both phrases like in my query **John Doe** are in the given fields. Thats for now pretty good. But sooner or later we get into trouble because if there is maybe two authors like **Max Doe, John Surname** then it will also return that. But it seems we dont have this occurance right now, so it is good and if there is something like that we also have the possibilty to disconnect the posts from an author.

---

<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: [February 14, 2024, 9:49am UTC](https://discuss.elastic.co/t/find-an-phrase-with-addtional-variants/351067/4 "2024-02-14T09:49:55Z")

</div>

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