---
type: api
title: Run a grok processor
description: Extract structured fields out of a single text field within a document.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v8/operation/operation-ingest-processor-grok
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v8/operation/operation-ingest-processor-grok
products:
  - Elasticsearch
---

# Run a grok processor

Availability: Generally available since 6.1

## Paths

- `GET` `/_ingest/processor/grok`

## Description

Extract structured fields out of a single text field within a document.
You must choose which field to extract matched fields from, as well as the grok pattern you expect will match.
A grok pattern is like a regular expression that supports aliased expressions that can be reused.

[Read the reference documentation](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/grok-processor.html)

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs support key-based authentication.
  You must create an API key and use the encoded value in the request header.
  For example:
  
  
  ```
  curl -X GET "${ES_URL}/_cat/indices?v=true" \
    -H "Authorization: ApiKey ${API_KEY}"
  ```
  
  To get API keys, use the `/_security/api_key` APIs.
- Basic: `Authorization: Basic <credentials>`
- Bearer: `Authorization: Bearer <token>`
  Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
  For examples, refer to [Token-based authentication services](https://www.elastic.co/guide/en/elasticsearch/reference/current/token-authentication-services.html)

## Response

`application/json`

- `patterns` (map string to string)
## Code examples

#### Console

```console
GET _ingest/processor/grok
```

#### JavaScript

```javascript
const response = await client.ingest.processorGrok();
```

#### Python

```python
resp = client.ingest.processor_grok()
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_ingest/processor/grok" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.ingest().processorGrok();
```

#### C#

```c#
var response = await client.Ingest.ProcessorGrokAsync();
```

#### PHP

```php
$resp = $client->ingest()->processorGrok();
```

#### Ruby

```ruby
response = client.ingest.processor_grok
```

