to find the exact match
mappings
"keywords": {
"type": "object",
"enabled": True,
"properties": {
"keyword_values": {
"type": "text",
"analyzer": "synonym_stemmer_bad_words_analyzer",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
}
Doc 1
"keywords": [
{
"keyword_values": "marbles"
},
{
"keyword_values": "flooring"
}
}
Doc 2
"keywords": [
{
"keyword_values": "marble"
},
{
"keyword_values": "floor"
}
}
Doc 3
"keywords": [
{
"keyword_values": "marble floor"
},
{
"keyword_values": "floor marble"
}
}
If am searching for marble with keywords
using the below query
Query: "keywords.keyword_values"
{
"query": {
"bool": {
"should": [
{
"match": {
"keywords.keyword_values": {
"query": "marble",
"operator": "AND",
"prefix_length": 0,
"max_expansions": 50,
"fuzzy_transpositions": "true",
"lenient": "false",
"zero_terms_query": "NONE",
"auto_generate_synonyms_phrase_query": "true",
"boost": 7
}
}
}
],
"minimum_should_match": "1"
}
}
}
I will be getting all three doc results, but I need to fetch only Doc 1 & Doc 2
so I have used the query with the keyword
Query: "keywords.keyword_values.keyword"
{
"query": {
"bool": {
"should": [
{
"match": {
"keywords.keyword_values.keyword": {
"query": "marble",
"operator": "AND",
"prefix_length": 0,
"max_expansions": 50,
"fuzzy_transpositions": "true",
"lenient": "false",
"zero_terms_query": "NONE",
"auto_generate_synonyms_phrase_query": "true",
"boost": 7
}
}
}
],
"minimum_should_match": "1"
}
}
}
in this am getting only Doc 2, here i need to fetch Doc 1 & Doc 2