

def test_function_score_to_dict():
    q = query.Q('function_score', query=query.Q('match', title='python'), functions=[query.SF('random_score'), query.SF('field_value_factor', field='comment_count', filter=query.Q('term', tags='python'))])
    d = {
        'function_score': {
            'query': {
                'match': {
                    'title': 'python',
                },
            },
            'functions': [{
                'random_score': {
                    
                },
            }, {
                'filter': {
                    'term': {
                        'tags': 'python',
                    },
                },
                'field_value_factor': {
                    'field': 'comment_count',
                },
            }],
        },
    }
    assert (d == q.to_dict())

dataset/ETHPy150Open elastic/elasticsearch-dsl-py/test_elasticsearch_dsl/test_query.py test_function_score_to_dict/original