This Project was created using ASP.NET, Elastic Search engin and TomTom.
Download Elastic program - Download
Run file
../elasticsearch-7.14.0/bin/elasticsearch.bat
Open solution
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
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
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
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\
var property = ElasticSearch.Search<Property>(_client, id.ToString(), f => f.propertyID, 10, 5);