2015-07-21 68 views
0

我嘗試使用以下代碼創建內存索引,但它會創建常規索引。 有什麼想法?使用Elasticsearch.net創建內存索引

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); 

回答

0

您對IndicesCreate方法調用的第二個參數不正確。請參閱下面的代碼以獲得更好的實現方法。前三行是相同的。在第四個中,我們正確地創建索引的設置。

  _body = new { 
       settings = new { 
        index = new { 
         store = new { 
          type = "memory" 
         } 
        } 
       } 
      }; 
      var index = client.IndicesCreate("sampleIndex", _body); 
+0

非常感謝,它的工作原理! – SerhatTopkaya