diff --git a/src/Nest/Analysis/TokenFilters/KeywordMarkerTokenFilter.cs b/src/Nest/Analysis/TokenFilters/KeywordMarkerTokenFilter.cs
index c58b6a11049..83159434aca 100644
--- a/src/Nest/Analysis/TokenFilters/KeywordMarkerTokenFilter.cs
+++ b/src/Nest/Analysis/TokenFilters/KeywordMarkerTokenFilter.cs
@@ -25,6 +25,12 @@ public interface IKeywordMarkerTokenFilter : ITokenFilter
///
[JsonProperty("keywords_path")]
string KeywordsPath { get; set; }
+
+ ///
+ /// A regular expression pattern to match against words in the text.
+ ///
+ [JsonProperty("keywords_pattern")]
+ string KeywordsPattern { get; set; }
}
///
@@ -40,6 +46,9 @@ public KeywordMarkerTokenFilter() : base("keyword_marker") { }
///
public string KeywordsPath { get; set; }
+
+ ///
+ public string KeywordsPattern { get; set; }
}
///
@@ -52,12 +61,17 @@ public class KeywordMarkerTokenFilterDescriptor
IEnumerable IKeywordMarkerTokenFilter.Keywords { get; set; }
string IKeywordMarkerTokenFilter.KeywordsPath { get; set; }
+ string IKeywordMarkerTokenFilter.KeywordsPattern { get; set; }
+
///
public KeywordMarkerTokenFilterDescriptor IgnoreCase(bool? ignoreCase = true) => Assign(a => a.IgnoreCase = ignoreCase);
///
public KeywordMarkerTokenFilterDescriptor KeywordsPath(string path) => Assign(a => a.KeywordsPath = path);
+ ///
+ public KeywordMarkerTokenFilterDescriptor KeywordsPattern(string pattern) => Assign(a => a.KeywordsPattern = pattern);
+
///
public KeywordMarkerTokenFilterDescriptor Keywords(IEnumerable keywords) => Assign(a => a.Keywords = keywords);
diff --git a/src/Tests/Tests/Analysis/TokenFilters/TokenFilterTests.cs b/src/Tests/Tests/Analysis/TokenFilters/TokenFilterTests.cs
index 21a95246fc7..61964d640fd 100644
--- a/src/Tests/Tests/Analysis/TokenFilters/TokenFilterTests.cs
+++ b/src/Tests/Tests/Analysis/TokenFilters/TokenFilterTests.cs
@@ -334,15 +334,19 @@ public class MarkerTests : TokenFilterAssertionBase
.KeywordMarker("marker", t => t
.IgnoreCase()
.Keywords("a", "b")
+ .KeywordsPattern(".*")
+ .KeywordsPath("path")
);
- public override ITokenFilter Initializer => new KeywordMarkerTokenFilter { IgnoreCase = true, Keywords = new[] { "a", "b" } };
+ public override ITokenFilter Initializer => new KeywordMarkerTokenFilter { IgnoreCase = true, Keywords = new[] { "a", "b" }, KeywordsPath = "path", KeywordsPattern = ".*" };
public override object Json => new
{
type = "keyword_marker",
keywords = new[] { "a", "b" },
- ignore_case = true
+ ignore_case = true,
+ keywords_path = "path",
+ keywords_pattern = ".*"
};
public override string Name => "marker";