FosElasticaBundle:如何转储传递给ElasticSearch的实际JSON? [英] FosElasticaBundle: how to dump the actual JSON passed to ElasticSearch?

查看:92
本文介绍了FosElasticaBundle:如何转储传递给ElasticSearch的实际JSON?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Symfony项目中使用FosElasticaBundle.我配置了映射,但出现异常为字段[_id]预期了一个简单值,但发现了[START_OBJECT]]".

I am using FosElasticaBundle in a Symfony project. I configured my mappings but I get exception "expected a simple value for field [_id] but found [START_OBJECT]]".

我想查看由FosElasticaBundle创建的实际JSON,以便可以直接在我的ElasticSearch服务器上对其进行测试,并了解有关该异常的更多信息.

I'd like to see the actual JSON created by FosElasticaBundle so I can directly test it against my ElasticSearch server, and understand more about the exception.

根据 FosElastica文档,一切应该在启用调试模式时(即在DEV环境中)记录日志,但是我看不到这种情况;我只看到教义查询,但没有JSON.

According to FosElastica documentation, everything should be logged when debug mode is enabled (i.e. in DEV environment) but I can't see this happening; I only see Doctrine queries, but no JSON.

如何转储由FosElasticaBundle创建的JSON?

How can I dump the JSON created by FosElasticaBundle?

# FOSElasticaBundle
fos_elastica:
    clients:
        default: { host: %elasticsearch_host%, port: %elasticsearch_port%, logger: false }
    indexes:
        app:
            types:
                user:
                    mappings:
                        name: ~
                        surname: ~
                    persistence:
                        driver: orm
                        model: AppBundle\Entity\User
                        provider: ~
                        listener: ~
                        finder: ~

推荐答案

我认为您应该只将logger设置为true而不是false

I think you should only set your logger to true instead of false

fos_elastica:
    clients:
        default:
            host: %elasticsearch_host%
            port: %elasticsearch_port%
            logger: true                        <---- set true here
    ...

这篇关于FosElasticaBundle:如何转储传递给ElasticSearch的实际JSON?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆