# Prepended Term Search is Faster than Term Search for Nested Field

**URL:** <https://discuss.elastic.co/t/prepended-term-search-is-faster-than-term-search-for-nested-field/317567>\
**Category:** Elasticsearch\
**Created:** [October 27, 2022, 12:40am UTC](https://discuss.elastic.co/t/prepended-term-search-is-faster-than-term-search-for-nested-field/317567 "2022-10-27T00:40:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aschattopadhyay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aschattopadhyay/32/112560_2.png) [@aschattopadhyay](https://discuss.elastic.co/u/aschattopadhyay)\
**Post date:** [October 27, 2022, 12:40am UTC](https://discuss.elastic.co/t/prepended-term-search-is-faster-than-term-search-for-nested-field/317567/1 "2022-10-27T00:40:23Z")

</div>

Hi there:

I am very new to Elasticsearch implementation and luckily I got this forum. Just wondering if I can get some help please regarding a scenario that we are facing for our Elasticsearch instance.

We have got like 100 million records in an index and we are trying to search records based on terms. So we have nested field like below in every record:

```auto
"identifiers" : [ 
    {
      "idValue" : "123456",
      "valueCodeConcat" : "TYPE005123456"
    }
]

```

If we do a search by TYPE005123456, it is way faster than if we do a search by 123456. I know behind the scene it is using Lucene indexing which is inverse indexing. However not sure how prepending terms with type value (e.g. TYPE005, TYPE001 etc.) is making search faster.

Any help would be much appreciated.

Thanks  
aschattopadhyay

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [October 27, 2022, 5:51am UTC](https://discuss.elastic.co/t/prepended-term-search-is-faster-than-term-search-for-nested-field/317567/2 "2022-10-27T05:51:45Z")

</div>

Please share your queries and mappings as well as information about which Elasticsearch version you are using.

---

<div class="post-metadata">

**Author:** ![aschattopadhyay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aschattopadhyay/32/112560_2.png) [@aschattopadhyay](https://discuss.elastic.co/u/aschattopadhyay)\
**Post date:** [October 28, 2022, 6:11am UTC](https://discuss.elastic.co/t/prepended-term-search-is-faster-than-term-search-for-nested-field/317567/3 "2022-10-28T06:11:23Z")

</div>

Hi Christian, I need to get back on this. Thanks for the reply. I need to verify what has been done till date from other team members.

---

<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 25, 2022, 6:11am UTC](https://discuss.elastic.co/t/prepended-term-search-is-faster-than-term-search-for-nested-field/317567/4 "2022-11-25T06:11:32Z")

</div>

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