Specifying both "analyzer" and "searchAnalyzer" for a FullTextField breaks the search


I am trying to implement a search functionality with Elasticsearch, Spring Boot & Kotlin. I have an entity annotated with @Indexed(index = "idx_my_entity"). This entity has a “name” field, which is a String. Let’s say that in the DB I have the following names: ‘John Silver’ and ‘Johny Iron’.

I want to be able to search ‘john’ and receive both entries. But when I search ‘johny’, I want to receive only the ‘Johny Iron’ entry. Or at least both entries with Johny Iron being the first one, although I’d prefer the first option. In order to get to the second option (returning both but the correct one first), I’ve created the following ElasticsearchAnalysisConfigurer:

class CustomElasticsearchAnalysisConfigurer() :
	ElasticsearchAnalysisConfigurer {
	override fun configure(context: ElasticsearchAnalysisConfigurationContext) {
			.tokenFilters("lowercase", "edge_ngram")


			.param("minGramSize", 1)
			.param("maxGramSize", 5)

The ‘name’ field is annotated as follows:

@Column(nullable = false, unique = true)
@FullTextField(name = "name")
@FullTextField(name = "name_ngram", analyzer = "edge_ngram")
@KeywordField(name = "name_sort", sortable = Sortable.YES)
var name: String,

I am using the match operator, without any fuzzy config.

I have tried using only this annotation:
@FullTextField(name = "name", analyzer = "edge_ngram", searchAnalyzer = "standard_analyzer_without_ngram")
, but then I don’t receive any results for ‘john’ or ‘johny’. This is why I got to the double @FullTextField annotation form above. Is there an issue with the searchAnalyzer property or am I doing something wrong?

Also, how can I get to my first idea? (searching for ‘johny’ would return only Johny Iron)

PS: I have the propert config for my CustomElasticsearchAnalysisConfigurer in application.yml and I am using drop and create for managing the Indexes on app startup. I use Hibernate Search 6.1.7 FINAL


Update. I will not edit the original question, in case someone else has the same problem. The issue on my side was that instead of “minGramSize” and “maxGramSize”, I should have had “min_gram” and “max_gram”.