如何在 DSL 查询中放置或条件化两个不同的键

How to put or condition in two different keys in DSL query

我有 dsl 查询需要 return

a = {'from': 0, 'size': 200,'query': {
    'bool': {
      'must': [
        {
          'terms': {
            'Country Owner.id.keyword': [
              'ABC101'
            ]
          }
        },
        {
          'terms': {
            'Territory Owner.id.keyword': [
              'ABC101'
            ]
          }
        }
      ]
    }
  }
}

只需将 must 更改为 should 就可以了

a = {'from': 0, 'size': 200,'query': {
    'bool': {
      'minimum_should_match': 1,                <--- change this
      'should': [                               <--- change this
        {
          'terms': {
            'Country Owner.id.keyword': [
              'ABC101'
            ]
          }
        },
        {
          'terms': {
            'Territory Owner.id.keyword': [
              'ABC101'
            ]
          }
        }
      ]
    }
  }
}