Uintra & Elastic Search

The search engine used in Uintra is Elastic Search, it is a free open source search engine and information about it can be found on the Elastic Search website.

Extending Search

From the box Uintra can search by activities (news, events and bulletins), content pages (pages from Umbraco), users and document names (attachments from activities).

But if you want to add new entities it is easy to do. You have to put your data into the Elasticsearch storage and teach it how to search it. Check out the documentation for Elastic Search here. Additionally we have added an example of adding links to the search parameters below:

1. Create a searchable link model:

public class SearchableLink : SearchableBase


       public string Link { get; set; }


This model should be saved in elasticsearch.

2. Create a Link service and derive it from the IIndexer.cs interface.

3. Implement the "FillIndex" signature:

public class LinkService : IIndexer


              private readonly ILinksProvider _linksProvider;// your custom links provider

              private readonly IElasticSearchRepository<SearchableLink> _elasticSearchRepository;

              public LinkService(

                     ILinksProvider linksProvider,

                     IElasticSearchRepository<SearchableLink> _elasticSearchRepository



              _linksProvider = linksProvider;

              this._elasticSearchRepository = _elasticSearchRepository;


              public void FillIndex()


                     var links = _userProvider.GetLinks() // get all links from storage

                     IEnumerable<SearchableLink> searchableLinks = links.Map<IEnumerable<SearchableLink>>();
                     // map all properties you need from your custom link model

                     _elasticSearchRepository.Save(searchableLinks); // store them in elastic




4. Now all your links is in the elastic index. Then you need to write a search query descriptor and a search mapping. In Uintra we use the Nest package with an elastic wrapper for .Net.

5. Create SearchableLinkMap:

public class SearchableLinkMap : SearchableBaseMap<SearchableLink>


              public SearchableLinkMap()


                     Text(t => t.Name(n => n.Link).Analyzer(ElasticHelpers.ReplaceNgram));




And register it via ninject in NinjectWebCommon.cs


6. Create the Search descriptor for Links in UintraElasticIndex.cs:

public QueryContainer[] GetLinkDescriptor(string query)


              var desc = new List<QueryContainer>


              new QueryContainerDescriptor<SearchableLink>().Match(m => m



                     .Field(f => f.Link)



              return desc.ToArray();



And put it in GetQueryContainers method:

protected override QueryContainer[] GetQueryContainers(string query)


              var containers = base.GetQueryContainers(query).ToList();







              return containers.ToArray();



Now Elastic know how to search your links.

7. Then you have to show search results on the UI:

Extend searchable type enum with link

public enum UintraSearchableTypeEnum


              News = SearchableTypeEnum.News,

              Events = SearchableTypeEnum.Events,

              Bulletins = SearchableTypeEnum.Bulletins,

              Content = SearchableTypeEnum.Content,

              Document = SearchableTypeEnum.Document,






Add new case with link in "List<T> CollectDocuments<T>(ISearchResponse<dynamic> response)"

case (int) UintraSearchableTypeEnum.Link:




That’s all now you can search on links in your model of Uintra!

Didn't find what you were looking for?

Our site is a work in progress and feedback is very much appreciated. If you could not find information regarding your problem please contact jba@compent.net or go to our github and create an issue if the problem relates to a bug or otherwise unintended technical functionality.