Package crate.elasticsearch.action.import_

Examples of crate.elasticsearch.action.import_.AbstractTransportImportAction


        // delete all
        esSetup.execute(deleteAll());
        esSetup.client().admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();

        // run restore without pyload relative directory
        ImportResponse response = executeRestoreRequest("");
        List<Map<String, Object>> imports = getImports(response);
        assertEquals(2, imports.size());

        assertTrue(existsWithField("1", "name", "item1", "users", "d"));
        assertTrue(existsWithField("2", "name", "item2", "users", "d"));
View Full Code Here


        super(NAME);
    }

    @Override
    public ImportResponse newResponse() {
        return new ImportResponse();
    }
View Full Code Here

    public static final String FILE_PATTERN = ".*_.*_.*\\.json\\.gz";

    public RestoreParser() {
        Map<String, ImportParseElement> elementParsers = new HashMap<String, ImportParseElement>();
        elementParsers.put("directory", new DirectoryParseElement());
        this.elementParsers = ImmutableMap.copyOf(elementParsers);
    }
View Full Code Here

                XContentParser.Token token;
                while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
                    if (token == XContentParser.Token.FIELD_NAME) {
                        String fieldName = parser.currentName();
                        parser.nextToken();
                        ImportParseElement element = elementParsers.get(fieldName);
                        if (element == null) {
                            throw new ImportParseException(context, "No parser for element [" + fieldName + "]");
                        }
                        element.parse(parser, context);
                    } else if (token == null) {
                        break;
                    }
                }
            }
View Full Code Here

                    if (token == XContentParser.Token.FIELD_NAME) {
                        String fieldName = parser.currentName();
                        parser.nextToken();
                        ImportParseElement element = elementParsers.get(fieldName);
                        if (element == null) {
                            throw new ImportParseException(context, "No parser for element [" + fieldName + "]");
                        }
                        element.parse(parser, context);
                    } else if (token == null) {
                        break;
                    }
                }
            }
            if (context.directory() == null) {
                context.directory(DumpParser.DEFAULT_DIR);
            }
        } catch (Exception e) {
            String sSource = "_na_";
            try {
                sSource = XContentHelper.convertToJson(source, false);
            } catch (Throwable e1) {
                // ignore
            }
            throw new ImportParseException(context, "Failed to parse source [" + sSource + "]", e);
        } finally {
            if (parser != null) {
                parser.close();
            }
        }
View Full Code Here

TOP

Related Classes of crate.elasticsearch.action.import_.AbstractTransportImportAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.