Search template in elastic 8.10

Greetings to all

I have an issue with my search template in ES 8.11,

It appears that there is data on the docName parameter, but there is no data when I search using the fulltext parameter and the docName parameter.

In this case, I need to search by docname and fulltext.

Is there any place in the template query where I can edit or add something?

Moreover, I have used five filters but only one is coming up in the search, even though I have used five.

I am using the search template for the first time, so I would appreciate any suggestions.
Here is Query.....

PUT _scripts/wsed-search-template-testnew
{
  "script": {
    "lang": "mustache",
    "source": """
    {
      "query": {
        "bool": {
          "must": [
            {{#fulltext}}
            {
              "multi_match": {
                "query": "{{fulltext}}",
                "type": "most_fields",
                "fields": [
                  "docName^3",
                  "attachment.content^2",
                  "description"
                  ],
                  "minimum_should_match": "100%"
              }
            }
            {{/fulltext}}
            
            {{#content }}
            {
              "match": {
                "attachment.content": {
                  "query": "{{content}}",
                  "minimum_should_match": "100%"
                }
              }
            }  
            {{/content}}  
       
            {{#docname }}
            {
              "match": {
                "docName": {
                  "query": "{{docname}}",
                  "minimum_should_match": "100%"
                }
              }
            }
            {{/docname}} 
 ],
 
            "filter": [
              {
                "term": {
                  "isActive": {"value": true  }
                }
                
                {{#isDeleted}}
                "term": {
                  "isDeleted": {"value": false  }
                }  
                {{/isDeleted}}
                
                {{#clientid}}
                
                "term": {
                  "clientId": {"value": "{{clientid}}"}
                }
                {{/clientid}}
                
                
                {{#folderid}}
                
                "term": {
                  "folderId": {"value": "{{folderid}}"}
                }
                {{/folderid}}
                
                {{#doctypes}}
                {
                  "terms": {
                    "docType": {{#toJson}}doctype{{/toJson}}
                  }
                }
                {{/doctypes}}
                
                {{#createdby}}
                {
                  "term": {
                    "docCreatedBy": {{#toJson}}createdby{{/toJson}}
                  }
                }
                {{/createdby}}      
              }
              ]
              
        }
           
      },
      
      "rescore": [
        {{#fulltext}}
        {
          "window_size": 500,
          "query": {
            "rescore_query": {
              "multi_match": {
                "query": "{{fulltext}}",
                "type": "phrase",
                "fields" : [ "docName^3", "attachment.content^2","description" ],
                "slop": "{{slopfulltext}}"
                
              }},
              "rescore_query_weight" : 10
          }
        }
        {{/fulltext}}
        
        {{#docname}}
        {{#fulltext}},{{/fulltext}}
        {
          "window_size": 500,
          "query": {
            "rescore_query": {
              "match_phrase":{
                "docName":{
                  
                  "query": "{{docname}}",
                  "slop": "{{slopdocname}}"
                }
              }
            },
            "rescore_query_weight" : 10
          }
        }
        {{#content}},{{/content}}
        {{/docname}}
        
        {{#content}}
        {{#fulltext}}{{^docname}},{{/docname}}{{/fulltext}}
        {
          "window_size": 500,
          "query": {
            "rescore_query": {
              "match_phrase":{
                "attachment.content":{
                  "query": "{{content}}",
                  "slop": "{{slopcontent}}"
                }
              }
            },
            "rescore_query_weight" : 10
          }
        }
        {{/content}}
        ],
        
        "highlight": {
          "fields": {
            "docName":{"number_of_fragments" : 0,"no_match_size":200},
            "description":{"number_of_fragments" : 0,"no_match_size":200}
          }
        },
        "sort":[
          {{#sortcolumn}}
          {
            "{{sortcolumn}}": "{{orderby}}"
          }   
          {{/sortcolumn}} ],
          
          "from" : "{{pageno}}{{^pageno}}0{{/pageno}}",
          "size" : "{{recordcount}}{{^recordcount}}200{{/recordcount}}"
          
    }"""
  }
}

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