﻿---
title: Using ingest processors in Painless
description: Some ingest processors expose behavior through Painless methods that can be called in Painless scripts that execute in ingest pipelines. All ingest methods...
url: https://www.elastic.co/elastic/docs-builder/docs/2422/reference/scripting-languages/painless/using-ingest-processors-in-painless
products:
  - Painless
---

# Using ingest processors in Painless
Some [ingest processors](https://www.elastic.co/elastic/docs-builder/docs/2422/reference/enrich-processor) expose behavior through Painless methods that can be called in Painless scripts that execute in ingest pipelines.

## Method usage

All ingest methods available in Painless are scoped to the `Processors` namespace. For example:
```json

{
  "pipeline": {
    "processors": [
      {
        "script": {
          "lang": "painless",
          "source": """
            long bytes = Processors.bytes(ctx.size);
            ctx.size_in_bytes = bytes;
          """
        }
      }
    ]
  },
  "docs": [
    {
      "_source": {
        "size": "1kb"
      }
    }
  ]
}
```


## Ingest methods reference


### Byte conversion

Use the [bytes processor](https://www.elastic.co/elastic/docs-builder/docs/2422/reference/enrich-processor/bytes-processor) to return the number of bytes in the human-readable byte value supplied in the `value` parameter.
```java
long bytes(String value);
```


### Lowercase conversion

Use the [lowercase processor](https://www.elastic.co/elastic/docs-builder/docs/2422/reference/enrich-processor/lowercase-processor) to convert the supplied string in the `value` parameter to its lowercase equivalent.
```java
String lowercase(String value);
```


### Uppercase conversion

Use the [uppercase processor](https://www.elastic.co/elastic/docs-builder/docs/2422/reference/enrich-processor/uppercase-processor) to convert the supplied string in the `value` parameter to its uppercase equivalent.
```java
String uppercase(String value);
```


### JSON parsing

Use the [JSON processor](https://www.elastic.co/elastic/docs-builder/docs/2422/reference/enrich-processor/json-processor) to convert JSON strings to structured JSON objects. The first `json` method accepts a map and a key. The processor converts the JSON string in the map as specified by the `key` parameter to structured JSON content. That content is added directly to the `map` object.
The second `json` method accepts a JSON string in the `value` parameter and returns a structured JSON object.
```java
void json(Map<String, Object> map, String key);
Object json(Object value);
```

You can then add this object to the document through the context object:
```java
Object json = Processors.json(ctx.inputJsonString);
ctx.structuredJson = json;
```


### URL decoding

Use the [URL decode processor](https://www.elastic.co/elastic/docs-builder/docs/2422/reference/enrich-processor/urldecode-processor) to URL-decode the string supplied in the `value` parameter.
```java
String urlDecode(String value);
```


### URI decomposition

Use the [URI parts processor](https://www.elastic.co/elastic/docs-builder/docs/2422/reference/enrich-processor/uri-parts-processor) to decompose the URI string supplied in the `value` parameter. Returns a map of key-value pairs in which the key is the name of the URI component such as `domain` or `path` and the value is the corresponding value for that component.
```java
String uriParts(String value);
```


### Network community ID

Use the [community ID processor](https://www.elastic.co/elastic/docs-builder/docs/2422/reference/enrich-processor/community-id-processor) to compute the network community ID for network flow data.
```java
String communityId(String sourceIpAddrString, String destIpAddrString, Object ianaNumber, Object transport, Object sourcePort, Object destinationPort, Object icmpType, Object icmpCode, int seed)
String communityId(String sourceIpAddrString, String destIpAddrString, Object ianaNumber, Object transport, Object sourcePort, Object destinationPort, Object icmpType, Object icmpCode)
```