@Override
    protected Result[] run(String value) {
        final Grok grok = grokPatternRegistry.cachedGrokForPattern(this.pattern, this.namedCapturesOnly);

        // the extractor instance is rebuilt every second anyway
        final Match match = grok.match(value);
        final Map<String, Object> matches = match.captureFlattened();
        final List<Result> results = new ArrayList<>(matches.size());

        for (final Map.Entry<String, Object> entry : matches.entrySet()) {
            // never add null values to the results, those don't make sense for us
            if (entry.getValue() != null) {
                results.add(new Result(entry.getValue(), entry.getKey(), -1, -1));
            }
        }

        return results.toArray(new Result[0]);
    }
@Test
    public void testIssue4773() {
        // See: https://github.com/Graylog2/graylog2-server/issues/4773
        final Map<String, Object> config = new HashMap<>();

        config.put("named_captures_only", true);

        // Using an OR with the same named capture should only return one value "2015" instead of "[2015, null]"
        final GrokExtractor extractor = makeExtractor("(%{BASE10NUM:num}|%{BASE10NUM:num})", config);

        assertThat(extractor.run("2015"))
                .hasSize(1)
                .containsOnly(
                        new Extractor.Result("2015", "num", -1, -1)
                );
    }