Terms_set within a nested query

Is it possible to use a terms_set within a nested query? I haven't be able to find any examples or documentation. Various testing attempts have failed. Most recently it has looked like...

Mappings as...

{
  "mappings": {
    "things": {
      "properties": {
        "tags": {
          "type": "nested",
          "properties": {
            "name":    { "type": "text"  },
            "date":    { "type": "date"    }
          }
        }
      }
    }
  }
}

and part of the query as nested query as`

{'query':
    {'nested': {
        'path': 'tags',
        'query': {
            'bool': {
                'must': [{
                    'terms_set': {
                        'tags.name': {
                            'minimum_should_match_script': {'source': '2'},
                            'terms': ['test_one', 'test_two']}}
                        }, {
                    'range': {
                        'tags.date': {
                            'gte': '2020-01-01',
                            'lte': '2021-12-31'
                        }
                    }
                }]
            }
        }
    }}}

Thanks

1 Like

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