1 |
|
2 | (function() {
|
3 | var alias, mappings, mixin, parse, queryToSearch, reader, settings, template, writer;
|
4 |
|
5 | parse = require('./parse');
|
6 |
|
7 | mixin = require('./mixin');
|
8 |
|
9 | reader = require('./reader');
|
10 |
|
11 | alias = require('./alias');
|
12 |
|
13 | mappings = require('./mappings');
|
14 |
|
15 | settings = require('./settings');
|
16 |
|
17 | template = require('./template');
|
18 |
|
19 | writer = require('./writer');
|
20 |
|
21 | queryToSearch = require('./query-to-search');
|
22 |
|
23 | module.exports = function(url) {
|
24 | var client, search, target;
|
25 | target = parse(url);
|
26 | client = require('./es')(target);
|
27 | search = queryToSearch(target.query);
|
28 | return {
|
29 | reader: function(lsearch, operdelete, trans) {
|
30 | var msearch;
|
31 | msearch = mixin(search, lsearch, {
|
32 | index: target.index,
|
33 | type: target.type
|
34 | });
|
35 | return reader(client, msearch, operdelete, trans);
|
36 | },
|
37 | alias: function() {
|
38 | return alias(client, {
|
39 | index: target.index
|
40 | });
|
41 | },
|
42 | settings: function() {
|
43 | return settings(client, {
|
44 | index: target.index
|
45 | });
|
46 | },
|
47 | mappings: function() {
|
48 | return mappings(client, {
|
49 | index: target.index,
|
50 | type: target.type
|
51 | });
|
52 | },
|
53 | template: function() {
|
54 | return template(client, {
|
55 | name: target.index
|
56 | });
|
57 | },
|
58 | writer: function(operdelete, trans, instream) {
|
59 | return writer(client, {
|
60 | index: target.index,
|
61 | type: target.type
|
62 | }, operdelete, trans, instream);
|
63 | }
|
64 | };
|
65 | };
|
66 |
|
67 | }).call(this);
|
68 |
|
69 |
|