# Enrich Processor: Match Longest

**URL:** https://discuss.elastic.co/t/enrich-processor-match-longest/287116
**Category:** Elasticsearch
**Created:** [October 19, 2021, 3:19pm UTC](https://discuss.elastic.co/t/enrich-processor-match-longest/287116 "2021-10-19T15:19:10Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tomx1](https://avatars.discourse-cdn.com/v4/letter/t/779978/32.png) [@tomx1](https://discuss.elastic.co/u/tomx1)
#### Post date: [October 19, 2021, 3:19pm UTC](https://discuss.elastic.co/t/enrich-processor-match-longest/287116/1 "2021-10-19T15:19:10Z")

</div>

We are enriching documents via Ingest pipeline. It looks like the enrichment processor is only able to enrich by exact match. But what I need is that it enriches incoming documents by longest match. Lets assume I'm enriching incoming documents by domain name and add the field "account" of the source index in case of a match.

My source Index looks like this:

```auto
example.com has account name "test"
subdomain.example.com has account "test1"

```

In theory the "domain" field could include endless subdomains, in my case I want the enrich processor to match the longest one. So that:

[this.is.just.a.test.subdomain.example.com](http://this.is.just.a.test.subdomain.example.com) is matched/enriched with account "test1" but [example.com](http://example.com) is matched with account "test". Any ideas how I can solve this?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [November 16, 2021, 3:19pm UTC](https://discuss.elastic.co/t/enrich-processor-match-longest/287116/2 "2021-11-16T15:19:51Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
