@Override
    public CloseableIterator<R> execute(final ServiceCallContext ctx, final Map params) {
        final String regex;
        if (params.containsKey(Params.REGEX)) {
            regex = (String) params.get(Params.REGEX);
        } else if (params.containsKey(Params.SEARCH)) {
            regex = ".*(" + params.get(Params.SEARCH) + ").*";
        } else {
            throw new IllegalStateException("Missing search/regex parameter");
        }
        final Class type = Params.type((String) params.get(Params.TYPE));

        return CloseableIterator.of((Iterator<R>) TinkerHelper.search(graph, regex, Optional.ofNullable(type)));
    }
Specify the type of Element to search for (optional)
tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/services/TinkerTextSearchFactory.java