ES fuzzy query

The fuzzy query mentioned here has the same query effect as mysql's Like.
For example, I query appName as bot-tts. mysql syntax is

select * from table where appName like '%bot-tts%'

In this way, the relevant data can be queried. But ES may sometimes require the same query effect.
The DSL syntax is as follows:

GET sdl/_search
{
"query":{
	"wildcard":{
			"appName.keyword":{
				"value":"*bot-tts*"
			}
		}
	}
}

Spring Data ES query statement assembly:

if (!StringUtils.isEmpty(overviewDto.getAppName())) {
    
    
    WildcardQueryBuilder appName = QueryBuilders.wildcardQuery("appName.keyword", "*" + overviewDto.getAppName() + "*");
	boolQuery.must(appName);
}

Guess you like

Origin blog.csdn.net/GoSaint/article/details/112258133