Package crate.elasticsearch.action.searchinto

Examples of crate.elasticsearch.action.searchinto.SearchIntoContext


    @Override
    public void parse(XContentParser parser, SearchContext context) throws Exception {
        XContentParser.Token token = parser.currentToken();
        if (token == XContentParser.Token.START_ARRAY) {
            boolean added = false;
            SearchIntoContext ctx = (SearchIntoContext)context;
            while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
                addAddress(ctx, parser.text());
            }
            if (!added) {
                ctx.emptyTargetNodes();
            }
        } else if (token == XContentParser.Token.VALUE_STRING) {
            addAddress((SearchIntoContext)context, parser.text());
        }
    }
View Full Code Here


     *
     * @return injected client or TransportClient
     */
    private Client getClient() {

        SearchIntoContext ctx = (SearchIntoContext)context;
        if (ctx.targetNodes().isEmpty()) {
            transportClient = null;
            return client;
        } else {
            ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder();
            builder.put("config.ignore_system_properties", true);
            builder.put("client.transport.sniff", true);
            builder.put("client.transport.ignore_cluster_name", true);
            builder.put("client.transport.ignore_cluster_name", true);
            transportClient = new TransportClient(builder, false);
            for (InetSocketTransportAddress address : ctx.targetNodes()) {
                ((TransportClient)transportClient).addTransportAddress(address);
            }
            return transportClient;
        }
    }
View Full Code Here

TOP

Related Classes of crate.elasticsearch.action.searchinto.SearchIntoContext

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.