# Indexing source code using ES and interest in the line number

**URL:** <https://discuss.elastic.co/t/indexing-source-code-using-es-and-interest-in-the-line-number/153173>\
**Category:** Elasticsearch\
**Created:** [October 19, 2018, 12:23pm UTC](https://discuss.elastic.co/t/indexing-source-code-using-es-and-interest-in-the-line-number/153173 "2018-10-19T12:23:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bearsmall](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bearsmall/32/36713_2.png) [@bearsmall](https://discuss.elastic.co/u/bearsmall)\
**Post date:** [October 19, 2018, 12:23pm UTC](https://discuss.elastic.co/t/indexing-source-code-using-es-and-interest-in-the-line-number/153173/1 "2018-10-19T12:23:23Z")

</div>

I saw this post from 2014 [Source Code Index using ES](https://discuss.elastic.co/t/source-code-index-using-es/17874)  
and I also saw this post from 2017 [Indexing source code using ES and ingest attachment plugin](https://discuss.elastic.co/t/indexing-source-code-using-es-and-ingest-attachment-plugin/91860)  
so how about now？is there any way to get the line number from the search result easily？

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [October 19, 2018, 7:58pm UTC](https://discuss.elastic.co/t/indexing-source-code-using-es-and-interest-in-the-line-number/153173/2 "2018-10-19T19:58:53Z")

</div>

> [@bearsmall](#):
>
> is there any way to get the line number from the search result easily？

I think there is not much to add to @dadoonet's answers in the threads you mentioned. The best way to be able to get line numbers is to actually index this kind of information. This usually means splitting the files in lines client-side and index it as one document per line, but this makes multi-line searches more complicated in case you need them. That or some client-side display logic in your UI. Elasticsearch has no own concept for text segmentation like "lines" or "paragraphs" unless you model your data accordingly.

---

<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, 2018, 8:09pm UTC](https://discuss.elastic.co/t/indexing-source-code-using-es-and-interest-in-the-line-number/153173/3 "2018-11-16T20:09:05Z")

</div>

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