0

我尝试使用以下代码创建内存索引,但它会创建常规索引。任何想法?

    var node = new Uri("http://localhost:9200");
    var settings = new ConnectionSettings(node);
    var client = new Elasticsearch.Net.ElasticsearchClient(settings);
    var js = JsonConvert.SerializeObject("{settings: { index.store.type: memory}");
    var index = client.IndicesCreate("sampleIndex", js);
4

1 回答 1

0

您对IndicesCreate方法调用的第二个参数不正确。请参阅下面的代码以更好地实现它。前三行是一样的。在第四个中,我们正确地创建了索引的设置。

            _body = new {
                settings = new {
                    index = new {
                        store = new {
                            type = "memory"
                        }
                    }
                }
            };
            var index = client.IndicesCreate("sampleIndex", _body);
于 2015-07-21T14:46:41.307 回答