Test a Grok pattern Added in 8.13.0
Test a Grok pattern on one or more lines of text. The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings.
Query parameters
-
ecs_compatibility string
The mode of compatibility with ECS compliant Grok patterns (disabled or v1, default: disabled).
Body Required
-
Lines of text to run the Grok pattern on.
POST
/_text_structure/test_grok_pattern
curl \
-X POST http://api.example.com/_text_structure/test_grok_pattern \
-H "Content-Type: application/json" \
-d '{"grok_pattern":"string","text":["string"]}'
Request examples
{
"grok_pattern": "string",
"text": [
"string"
]
}
Response examples (200)
{
"matches": [
{
"matched": true,
"fields": {
"additionalProperty1": [
{
"match": "string",
"offset": 42.0,
"length": 42.0
}
],
"additionalProperty2": [
{
"match": "string",
"offset": 42.0,
"length": 42.0
}
]
}
}
]
}