Skip to content

[DOC]Search templates loop works wrong #5054

Closed
@SonaGharibyan

Description

@SonaGharibyan

What do you want to do?

  • Request a change to existing documentation
  • Add new documentation
  • Report a technical problem with the documentation
  • Other

Tell us about your request. Provide a summary of the request and all versions that are affected.
Having issues with using search templates loops https://opensearch.org/docs/latest/search-plugins/search-template/#loops
I have this query

{
   "source":{
    "query":{
      "bool":{
         "filter":[
            {
               "terms":{
                  "field":["{{#names}}","{{.}}","{{/names}}","3"]
               }
            }
         ]
      }
   }
},
   "params":{
      "names":["1", "2"]
   }
}

which should return items where "field" equals to "1", "2" or "3". But it also return items where "field" is to empty string ("").

Is there another way to destruct "names" array?
pls update docs accordingly

What other resources are available? Provide links to related issues, POCs, steps for testing, etc.
Found similar question just from Elastic Search -> https://stackoverflow.com/questions/67590223/how-to-pass-array-to-elasticsearch-search-template-using-mustache

Metadata

Metadata

Assignees

No one assigned

    Labels

    BacklogIssue: The issue is unassigned.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions