# Using elasticSearch to index git repos

**URL:** <https://discuss.elastic.co/t/using-elasticsearch-to-index-git-repos/77519>\
**Category:** Elasticsearch\
**Created:** [March 6, 2017, 2:41pm UTC](https://discuss.elastic.co/t/using-elasticsearch-to-index-git-repos/77519 "2017-03-06T14:41:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmls](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jmls](https://discuss.elastic.co/u/jmls)\
**Post date:** [March 6, 2017, 2:41pm UTC](https://discuss.elastic.co/t/using-elasticsearch-to-index-git-repos/77519/1 "2017-03-06T14:41:56Z")

</div>

Brand new ES user here, so I'm not quite up to speed with the terminology ..

I would like to use ES to index a git repo, so that the source code can be searched (like github) . Is this possible ?

It would seem an obvious thing to be able to do, but I can't seem to find relevant information - a google search on elasticsearch and git is not nearly specific enough 😉

thanks

---

<div class="post-metadata">

**Author:** ![jmls](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jmls](https://discuss.elastic.co/u/jmls)\
**Post date:** [March 13, 2017, 11:39am UTC](https://discuss.elastic.co/t/using-elasticsearch-to-index-git-repos/77519/2 "2017-03-13T11:39:45Z")

</div>

ping .. really would appreciate any thoughts or ideas on this

---

<div class="post-metadata">

**Author:** ![Oozza](https://avatars.discourse-cdn.com/v4/letter/o/76d3ee/32.png) [@Oozza](https://discuss.elastic.co/u/Oozza)\
**Post date:** [March 13, 2017, 1:11pm UTC](https://discuss.elastic.co/t/using-elasticsearch-to-index-git-repos/77519/3 "2017-03-13T13:11:14Z")

</div>

Github repositories are indexed in Elasticsearch ([source](https://www.elastic.co/use-cases/github)). Try this page [https://github.com/search/advanced](https://github.com/search/advanced).

Add: If you want to do it yourself, I can only recommend to read throught Elastic docs for Elasticsearch and Logstash capabilities and use-cases. Also look if you can find usefull logstash input plugin or Beat.

---

<div class="post-metadata">

**Author:** ![Babadofar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/babadofar/32/44803_2.png) [@Babadofar](https://discuss.elastic.co/u/Babadofar)\
**Post date:** [March 13, 2017, 5:46pm UTC](https://discuss.elastic.co/t/using-elasticsearch-to-index-git-repos/77519/4 "2017-03-13T17:46:37Z")

</div>

You need to figure out how to retrieve contents from github. Perhaps there is an API you can use? Once you have access to the github content you need to figure how to get it into elasticsearch. That is the easy part. The hard part is figuring out how to handle changes to the repo. The easy way out is to ignore changes.

If you need inspiration, this blog post shows how to index bitbucket repositories using python and a 3 year old version of elasticsearch. However, the principles should be similar to what you would do today.

> **[Bitbucket to Elasticsearch Connector - Search Nuggets](http://blog.comperiosearch.com/blog/2014/09/18/bitbucket-elasticsearch-connector/)**
>
> “Ability to search source code? (BB-39)” is an issue created in July 2011 on Bitbucket and its status is still new. If you have used Bitbucket before, you would have certainly noticed that there is no way to search in a repository’s source code. Now...

---

<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:** [April 10, 2017, 5:46pm UTC](https://discuss.elastic.co/t/using-elasticsearch-to-index-git-repos/77519/5 "2017-04-10T17:46:57Z")

</div>

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