Find an Phrase with addtional variants

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:

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

unstemmed analyzer or field propertiy also my analyzerproperties:

"author": {
	"type": "text",
	"fields": {
		"unstemmed": {
			"type": "text",
			"analyzer": "standard_unstemmed"
		}
	},
	"analyzer": "standard_unstemmed"
},
...
"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!

Hi @libertey

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

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

{
	"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.

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