Skip to content

DmytroLamashevskyi/ElasticSearchProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Elastic Search Project

This Project was created using ASP.NET, Elastic Search engin and TomTom.

Screenshots

Main window of ASP program

Main window

View when we open some property

View window

Panel to select fields for search

Filters panel

Run Locally

Step 1)

Download Elastic program - Download

Step 2)

Run file

  ../elasticsearch-7.14.0/bin/elasticsearch.bat

Step 3)

Open solution

Step 4)

If you have file to import

  curl -X PUT "localhost:9200/sample_data/_bulk?pretty" -H 'Content-Type: application/x-ndjson' --data-binary @sample.json

sample_data - specyfic index that will be used in project more information about import you can find here

You can import properties.json from folder TestData using ElasticSearchUtil project:

Enter data in file Program.cs in Main()

    var path = @"..\TestData\properties.json";
    var indexName = "property";

path - path to the json array file
indexName - index that will be register in Elastic Search

Step 5)

In project ElasticSearchProject in file appsettings.json enter Tom Tom Key and Elastic Search Index

  "TomTomKey": "<Key>",
  "ElasticSearchIndex": "<Index>" 

TomTomKey - you can get in from Developer tomtom
Index - index that was registered in Elastic search
You can chek them:

  http://localhost:9200/_aliases?pretty=true

Usage/Examples

To filter information please create request in ElasticsearchExtension

public static ISearchResponse<T> MatchAll<T>(ElasticClient client, string query, int from = 0, int size = 1) where T : class
{
  var results = client.Search<T>(s => s
     .Query(q => q.MatchAll()).From(from).Size(size));
  return results;
}

Parameters to use: ElasticClient client - instance of ElasticClient
string query - word to find
int from - start range to return results
int size - count of results
Expression<Func<T, object>> field - field to Search\

Example call

  var property = ElasticSearch.Search<Property>(_client, id.ToString(), f => f.propertyID, 10, 5); 

About

Project on ASP. CORE and using technology [Elastic Search]

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published