ElasticSearch 2.X升级到6.X遇到的几个问题

1.IndexExists检测索引是否存在,更简洁了,可以这样

_ElasticClient.IndexExists(indices : indexName).Exists

2.索引数据的时候,如果数据是个字符串json,那么索引后查看数据是有问题的,索引的数据需要是个Model对象,此情况是个人遇到的,不确定是否有其他操作方法

3.如果索引数据是做了路由处理的话,那么使用Id搜索或者删除也必须加上路由信息,不然会404找不到的,此情况只针对Id搜索或删除

_ElasticClient.Get(new DocumentPath<T>(esId), s => s.Type(_EsType).Routing(routing))

_ElasticClient.DeleteAsync(new DeleteRequest(_ElasticClient.ConnectionSettings.DefaultIndex, _EsType, esId) { Routing = routing });

猜你喜欢

转载自www.cnblogs.com/CuiRicky/p/9772189.html