ElasticSearch NEST:通过指定json通过ElasticClient创建索引

ElasticSearch NEST:通过指定json通过ElasticClient创建索引,第1张

ElasticSearch NEST:通过指定json通过ElasticClient创建索引

最简单的解决方案是原始问题中选项1的实现。

public void CreateIndex(string indexName, string json){    ElasticClient client = GetClient();    var response = _client.Raw.IndicesCreatePost(indexName, json);    if (!response.Success || response.HttpStatusCode != 200)    {        throw new ElasticsearchServerException(response.ServerError);    }}

修改了转换器,JsonReaders和JsonSerializers之后,我发现IndexSettingsConverter似乎没有正确地将任意设置json反序列化为有效的IndexSettings对象。感觉到一个兔子洞,我接受了Manolis的建议,并弄清楚了如何直接对ElasticClient.IElasticsearchClient应用任意json以避免对安全性和连接细节进行逆向工程。

做出这个结论是费力的,而且如果不处理大量未记录的NEST代码,这是完全不可能的。



欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/4973673.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-14
下一篇2022-11-13

发表评论

登录后才能评论

评论列表(0条)

    保存