Introducing Elasticsearch step by step

  • Tutorial
Today we’ll talk about the full-text search engine Elasticsearch (hereinafter referred to as ES), with which
the Docsvision 5.5 platform works.

1. Installation

You can download the current version from the link:
Installer screenshot below:

2. Health Check

After the installation is completed, go to the address
http: // localhost: 9200 / A
page with the ES status should appear, an example below:

If the page did not open, make sure that the Elasticsearch service is running. On Windows, this is
an Elasticsearch service.

3. Connection to Docsvision

Connection to Elasticsearch is configured on the full-text
indexing service page .

Here you need to specify:
1. The address of the Elasticsearch server (set during installation).
2. The connection string to the DBMS.
3. Docsvision address (in the format ConnectAddress = http: // SERVER / DocsVision / StorageServer / StorageServerService.
4. On the "Cards" and "Directories" tab, you need to configure the data that
needs to be indexed.
You also need to make sure that the account under which the Docsvision
Fulltext Indexing service is running has access to the MS SQL Docsvision database.
After connecting, you need to make sure that the tasks with the prefix are created in the MS SQL database:
"DV: FullText_ <NMBD> _CardWithFilesPrepareRange"

After completing the settings, the search bar will be unlocked in the Windows client.

4. REST API Elastic

The administrator can get various information about the operation of Elasticsearch using the
provided REST API.
In the following examples, we will use the Insomnia Rest Client.

Getting general information

Once the service has started and started working (http: // localhost: 9200 / in the browser), you can
run the request:
http: // localhost: 9200 / _cat / health? V

Get a response about the status of the Elasticsearch service (in the browser):

Status response in Insomnia:

Pay attention to Status - Green, Yellow, Red. The official documentation on the statuses is as follows:
• Green - Everything is fine (the Cluster is fully operational)
• Yellow - All data is available, but some replicas in the cluster are not yet allocated for them
• Red - Some data is not available for any reason (the cluster itself is functioning normally)
Getting states about nodes in a cluster and their state (I have 1 node):
http: // localhost: 9200 / _cat / nodes? V

All indices (indices) ES:
http: // localhost: 9200 / _cat / indices? v

In addition to the indexes from Docsvision, there can be indexes of other applications - heartbeat,
kibana - if you use them. Necessary from unnecessary can be sorted. For example,
take only the indexes that have% card% in the name:
http: // localhost: 9200 / _cat / indices / * card *? V & s = index

Elasticsearch Configuration

Getting Elasticsearch settings:
http: // localhost: 9200 / _nodes
The result will be quite extensive, including the path to the logs:

How to find out a list of indexes, we already know, Docsvision does this automatically, giving the index a name in the format:
<namedb + view of the Indexed Card>
You can also create your own independent index:
http: // localhost: 9200 / customer? Pretty
Only this will not be a GET, but a PUT request:

Result: the

following request will show all indexes, including the new ones (customer):
http: // localhost : 9200 / _cat / indices? V

5. Getting information about indexed data

Elasticsearch Index Status

After the initial configuration by Docsvision is completed, the service should be ready to work and start indexing data.
First of all, we’ll check that the indexes are filled in and their size is larger than the standard “bytes” by the query we already know:
http: // localhost: 9200 / _cat / indices? V
as a result we see: 87 “tasks” and 72 “documents” are indexed if we speak in in terms of our EDMS:

After some time, the results are as follows (by default, job indexing starts every 5 minutes):

We see that the number of documents has increased.

How to understand that the desired card is indexed?

• Firstly, you need to make sure that the card type in Docsvision matches the data specified in the Elascticsearch settings.
• Secondly, wait for the indexing of the card array - if it gets into Docsvision, it should take some time before the data appears in the repository.
• Thirdly, you can search for a card by CardID. You can do this by request:

http: // localhost: 9200 / _search? Q = _id = 2116C498-9D34-44C9-99B0-CE89465637C9

If the card is in the storage, we will see its "raw" data, if not, we will see something like this answer:

Search for a card in the Elasticsearch node

Find a document by the exact match of the Description:
http: // localhost: 9200 / _search? Q = description: outgoing tv1 field

search for a document that has an 'Incoming' entry in Description
http: // localhost: 9200 / _search? Q = description like Incoming

Search for a card by the contents of the attached file

Find all cards of the document type:
http: // localhost: 9200 / _search? q = _type: CardDocument

or all cards of the job type:
http: // localhost: 9200 / _search? q = _type: CardTask

Using the and constructions and the parameters that Elasticsearch returns as JSON, you can assemble the following request:
http: // localhost: 9200 / _search? q = _type: CardTask and Employee_RoomNumber: Eagle office and Employee_FirstName: Konstantin

It will show all job type cards, among users who have FirstName = Konstantin, and who are in Orel Office.
In addition to LIKE, there are other documented parameters:
unlike, fields, docs, content, etc.
All of them are described here .

That's all for today!

# docsvision # docsvisionECM

Useful links:
  1. Insomnia Rest client

Also popular now: