I have working search for single search on multiple fields and wildcard(using ngram).
Index creation(s-search index):
{
"settings": {
"number_of_shards": 2,
"number_of_replicas": 1,
"index.mapping.coerce": false,
"analysis": {
"filter": {
"ngram_filter": {
"type": "ngram",
"min_gram": 3,
"max_gram": 3
}
},
"analyzer": {
"ngram_tokenizer_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"ngram_filter"
]
}
}
}
},
"mappings": {
"dynamic": "strict",
"properties": {
"sName": {
"type": "text",
"analyzer": "ngram_tokenizer_analyzer",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"source": {
"type": "text",
"analyzer": "ngram_tokenizer_analyzer",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"description": {
"type": "text",
"analyzer": "ngram_tokenizer_analyzer",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"containerType": {
"type": "text",
"analyzer": "ngram_tokenizer_analyzer",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"comments": {
"type": "text",
"analyzer": "ngram_tokenizer_analyzer",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
Here's the query(spring generated):
{
"multi_match" : {
"query" : "str1",
"fields" : [
"comments^1.0",
"containerType^1.0"
"description^1.0",
"sName^1.0",
"source^1.0"
],
"type" : "best_fields",
"operator" : "OR",
"slop" : 0,
"prefix_length" : 0,
"max_expansions" : 50,
"zero_terms_query" : "NONE",
"auto_generate_synonyms_phrase_query" : true,
"fuzzy_transpositions" : true,
"boost" : 1.0x
}
}
it is working fine.
now I want to search multiple terms(with AND clause, both terms should be available in document) on same multi-fields(wildcard using ngram)
Any suggestion/guidance to achieve this?
I am trying to use bool but didn't get success yet.