RequestError: RequestError(400, 'parsing_exception', '[terms] query does not support [country]')

I am new to Elasticsearch and getting error while running this:

for brand in extract['brand'].values:
    s_names = Search() \
                .query('multi_match', 
                       type = "cross_fields", 
                       query = brand, 
                       fields = ['field 1', 'field 2']) \
                .filter("terms", country="United Kingdom") \
                .query('bool', filter=[(Q("match", brand=brand)) | (~Q("exists", field='brand'))]) \
                .query('bool', filter=[(Q("match", industry='Automobile')) | (~Q("exists", field='industry'))]) 
    s_names.aggs \
                .bucket('bucket_name', 'terms', field='bucket_field', size=500) \
                .metric('best', 'top_hits', size=10)
    ms_names = ms_names.add(s_names)
    
responses_names = ms_names.execute()
RequestError: RequestError(400, 'parsing_exception', '[terms] query does not support [country]')

Can somebody please help me out, what am I doing wrong?

Found it:

.filter("terms", country=["United Kingdom"])

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