Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,22 @@ public static CategorizationAnalyzerConfig buildStandardCategorizationAnalyzer(L
.build();
}

/**
* Create a <code>categorization_analyzer</code> that will be used by the ES|QL categorize function.
* The only difference from the DSL analyzer is the tokenizer (standard instead of ml_standard).
* This means the results are slightly different from the categorize text aggregation and the ML job,
* however you can use these tokens for looking up messages in indices generated with the standard
* tokenizer. The latter is considered more important.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

*/
public static CategorizationAnalyzerConfig buildStandardEsqlCategorizationAnalyzer() {

return new CategorizationAnalyzerConfig.Builder().addCharFilter("first_line_with_letters")
.setTokenizer("standard")
.addDateWordsTokenFilter()
.addLimitFilter()
.build();
}

private final String analyzer;
private final List<NameOrDefinition> charFilters;
private final NameOrDefinition tokenizer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

Expand All @@ -48,9 +47,8 @@
*/
public class CategorizeBlockHash extends BlockHash {

private static final CategorizationAnalyzerConfig ANALYZER_CONFIG = CategorizationAnalyzerConfig.buildStandardCategorizationAnalyzer(
List.of()
);
private static final CategorizationAnalyzerConfig ANALYZER_CONFIG = CategorizationAnalyzerConfig
.buildStandardEsqlCategorizationAnalyzer();
private static final int NULL_ORD = 0;

private final int channel;
Expand Down
Loading