# Alternative to lookup datatype?

**URL:** <https://discuss.elastic.co/t/alternative-to-lookup-datatype/329836>\
**Category:** Elasticsearch\
**Created:** [April 12, 2023, 12:55pm UTC](https://discuss.elastic.co/t/alternative-to-lookup-datatype/329836 "2023-04-12T12:55:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![captainzura195](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/captainzura195/32/119685_2.png) [@captainzura195](https://discuss.elastic.co/u/captainzura195)\
**Post date:** [April 12, 2023, 12:55pm UTC](https://discuss.elastic.co/t/alternative-to-lookup-datatype/329836/1 "2023-04-12T12:55:39Z")

</div>

I wanted to populate a description field using its corresponding key, code, and another index having a key, lookup\_code, column, and a corresponding description column but without the lookup datatype I am finding it hard to achieve a lookup on the index level since lookup data type, as well as scripted fields, have been deprecated. How can I achieve the same?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [April 12, 2023, 2:38pm UTC](https://discuss.elastic.co/t/alternative-to-lookup-datatype/329836/2 "2023-04-12T14:38:02Z")

</div>

Hi @captainzura195 Welcome to the community!

I think there's two approaches

Runtime field lookup, runtime fields are the new scripted fields.

> **[Retrieve a runtime field | Elasticsearch Guide \[8.7\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/runtime-retrieving-fields.html#lookup-runtime-field)**

Is executed at runtime so it's a little less performant and may not scale as well.

Or enrich processor which is done at ingest time and so the day that it's actually appended to the document and make search very fast.

> **[Enrich your data | Elasticsearch Guide \[8.7\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest-enriching-data.html)**

Can you show me the Deprecation notices for You are referring to?

---

<div class="post-metadata">

**Author:** ![captainzura195](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/captainzura195/32/119685_2.png) [@captainzura195](https://discuss.elastic.co/u/captainzura195)\
**Post date:** [April 14, 2023, 1:17pm UTC](https://discuss.elastic.co/t/alternative-to-lookup-datatype/329836/3 "2023-04-14T13:17:46Z")

</div>

So right now the scenario is that we have a field "phase\_status" which we want to add to new documents getting indexed based on the "phase\_code" field in these documents.  
So we have created an index "Lookup\_Index" which has 2 fields "phase\_status", "phase\_code", eg values: 1: Tested, 2: Testing, 3: Deployed  
So with basic enrich features, we are able to get this done to the newer documents getting added.  
But when I wish to add this to older indexes that already have the field "phase\_status", will enrich add another columnn with same name , add values to the same column?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [April 14, 2023, 3:53pm UTC](https://discuss.elastic.co/t/alternative-to-lookup-datatype/329836/4 "2023-04-14T15:53:51Z")

</div>

> [@captainzura195](#):
>
> But when I wish to add this to older indexes that already have the field "phase\_status", will enrich add another columnn with same name , add values to the same column?

No enrich will not work on previously indexed documents, in that case you will need to either reindex or use the runtime method.

Hmmm I guess you might be able to run an [update\_by\_query](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html) with script to back fill the old docs

---

<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:** [May 12, 2023, 3:54pm UTC](https://discuss.elastic.co/t/alternative-to-lookup-datatype/329836/5 "2023-05-12T15:54:18Z")

</div>

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