2016-05-05 9 views
0

私たちは、内部アプリケーション監視のために毎日インデックスを作成しています。私たちは1日に約0.3百万件のレコードを受け取り、これは木場を使用してリアルタイムで分析されています。ElasticSearch to MS SQL Server

ここで、elasticsearchからMSSQL Serverにデータを移動します。 nodejs elasticsearchモジュールを使用して、データをMSSQL Serverに移動できます。

ただし、約1000レコードの小さなボリュームでも実行できます。 elasticsearchからすべてのレコードを読み込み、MSSQLサーバーにダンプしたいので、それを行うには良い方法がありますか?

答えて

0

私はelasticsearchスクロール機能を使用して同じことを達成できました。ここでの場合リンクのサンプルコードが非アクティブ

var allTitles = []; 

// first we do a search, and specify a scroll timeout 
client.search({ 
    index: 'myindex', 
    // Set to 30 seconds because we are calling right back 
    scroll: '30s', 
    search_type: 'scan', 
    fields: ['title'], 
    q: 'title:test' 
}, function getMoreUntilDone(error, response) { 
    // collect the title from each response 
    response.hits.hits.forEach(function (hit) { 
    allTitles.push(hit.fields.title); 
    }); 

    if (response.hits.total !== allTitles.length) { 
    // now we can call scroll over and over 
    client.scroll({ 
     scrollId: response._scroll_id, 
     scroll: '30s' 
    }, getMoreUntilDone); 
    } else { 
    console.log('every "test" title', allTitles); 
    } 
}); 
なり https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference-2-2.html#api-scroll-2-2

詳細については、リンクを参照してください