﻿---
title: Analysis Predicate Context
description: Use a painless script to determine whether or not the current token in an analysis chain matches a predicate. Variables Return API The standard Painless...
url: https://www.elastic.co/elastic/docs-builder/docs/2350/reference/scripting-languages/painless/painless-analysis-predicate-context
products:
  - Painless
---

# Analysis Predicate Context
Use a painless script to determine whether or not the current token in an analysis chain matches a predicate.
**Variables**
<definitions>
  <definition term="params (Map, read-only)">
    User-defined parameters passed in as part of the query.
  </definition>
  <definition term="token.term (CharSequence, read-only)">
    The characters of the current token
  </definition>
  <definition term="token.position (int, read-only)">
    The position of the current token
  </definition>
  <definition term="token.positionIncrement (int, read-only)">
    The position increment of the current token
  </definition>
  <definition term="token.positionLength (int, read-only)">
    The position length of the current token
  </definition>
  <definition term="token.startOffset (int, read-only)">
    The start offset of the current token
  </definition>
  <definition term="token.endOffset (int, read-only)">
    The end offset of the current token
  </definition>
  <definition term="token.type (String, read-only)">
    The type of the current token
  </definition>
  <definition term="token.keyword (boolean, read-only)">
    Whether or not the current token is marked as a keyword
  </definition>
</definitions>

**Return**
<definitions>
  <definition term="boolean">
    Whether or not the current token matches the predicate
  </definition>
</definitions>

**API**
The standard [Painless API](https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-api-reference-shared.html) is available.