ElasticSearch-PHP踩过的坑

本人使用的ElasticSearch7.3
官方文档坑得要命
好多demo拿下来根本没法用
每个demo创建完索引(index)再创建文档模板(mapping)的时候都报错
这边网上查到的资料有的说因为ElasticSearch移除了type
需要添加 ‘include_type_name’ => true
经测试,纯属扯淡!!!
ElasticSearch-PHP踩过的坑
通过排查log日志发现,log中报“No handler for type [string] declared on field [profile]”的错误
ElasticSearch-PHP踩过的坑
最后再查阅资料得到真正的错误原因:创建mapping时index的类型必须为布尔型,type中不再使用string类型
ElasticSearch-PHP踩过的坑
es官方demo中还在使用string类型,寡人简直无力吐槽