Angular 4 ElasticSearch example – How to create an Index

In this tutorial, we’re gonna look at way to create an Elasticsearch Index in an Angular 4 Project.

Related Posts:
Angular 4 ElasticSearch – Quick Start – How to add Elasticsearch.js
Angular 4 ElasticSearch example – Add Document to Index
Angular 4 ElasticSearch example – Get All Documents in Index
Angular 4 ElasticSearch example – Documents Pagination with Scroll

Elasticsearch Tutorials:
Elasticsearch Overview
ElasticSearch Filter vs Query
ElasticSearch Full Text Queries – Basic

I. How to

1. Add ElasticSearch to Angular 4 Project

Please visit Angular 4 ElasticSearch – Quick Start – How to add Elasticsearch.js for details.

With the post, you will know how to:
– Install ElasticSearch
– Add ElasticSearch to Angular 4 Project
– Use it in the project

2. Create an ElasticSearch Index
2.1 Connect to ElasticSearch

2.2 Ping ElasticSearch

If server is available, your Browser console shows:

Now you can create an Index.

2.3 Create an ElasticSearch Index

II. Practice

Project Structure:
angular-4-elasticsearch-add-index-structure

1. App Module

2. ElasticSearch Service

3. Add Index Component

test-es.component.ts

test-es.component.html

4. App Component

app.component.ts

app.component.html

5. Check Result

Run Angular 4 App, go to http://localhost:4200/:
angular-4-elasticsearch-add-index-result-url

Open Browser Console, we can see:
angular-4-elasticsearch-add-index-result-console-ok

Fill index in the box (for example: jsa_index) and press Submit button, we can see:
– in Browser Console:
angular-4-elasticsearch-add-index-result-console-ack

– in ElasticSearch Console:
angular-4-elasticsearch-add-index-result-console-elasticsearch

III. Sourcecode

Angular4ElasticSearch-createIndex

By JavaSampleApproach | October 13, 2017.


Related Posts


Got Something To Say:

Your email address will not be published. Required fields are marked *

*