Hello!
Today we will talk about the full-text search engine Elasticsearch (hereinafter referred to as ES), with which
the Docsvision 5.5 platform works.
After installation is complete, go to http://localhost:9200/
The ES status page should be displayed, example below:
If the page does not open, make sure the Elasticsearch service is running. On Windows this
elasticsearch service.
3. Connecting to Docsvision
Connection to Elasticsearch is configured on the page of the full-text service.
indexing.
Here you need to specify:
1. Elasticsearch server address (set during installation).
2. DBMS connection string.
3. Docsvision address (in the format ConnectAddress=http://SERVER/DocsVision/StorageServer/StorageServerService.
asmx)
4. On the "Cards" and "References" 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 service is running
Fulltext Indexing service, has access to the Docsvision database on MS SQL.
After connecting, you need to make sure that tasks with the prefix were created in the MS SQL database:
"DV:FullText_<DBNAME>_CardWithFilesPrepareRange"
After completing the settings in the Windows client, the search bar will be unlocked.
4. Elastic REST API
An administrator can get various information about the operation of Elasticsearch using
provided by the REST API.
In the following examples, we will use the Insomnia Rest Client.
Getting general information
Once the service is up and running (http://localhost:9200/ in a browser), you can
execute query: http://localhost:9200/_cat/health?v
Get a response about the status of the Elasticsearch service (in the browser):
Status response in Insomnia:
Let's pay attention to Status — Green, Yellow, Red. The official documentation says the following about statuses:
• Green - All is well (Cluster is fully functional)
• Yellow - All data is available, but some replicas in the cluster have not yet been allocated to them.
• Red - Part of the data is unavailable for any reason (the cluster itself is functioning normally)
Getting states about the nodes in the 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 indexes from Docsvision, there may be indexes of other applications - heartbeat,
kibana - if you use them. You can sort what you need from what you don't need. For example,
take only indexes that have %card% in their names: 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 paths to the logs:
How to find out the list of indexes, we already know, Docsvision does this automatically by giving the name of the index in the format:
<database name+IndexedCard type>
You can also create your own independent index: http://localhost:9200/customer?pretty
Only it will not be a GET, but a PUT request:
Result:
the following query will show all indexes, including new ones (customer): http://localhost:9200/_cat/indices?v
5. Getting information about indexed data
Status of Elasticsearch indexes
After the initial configuration by Docsvision has been completed, the service should be ready to work and start indexing data.
First of all, let's check that the indexes are filled and their size is larger than the standard "bytes" with the query already familiar to us: http://localhost:9200/_cat/indices?v
as a result, we see: 87 “tasks” and 72 “documents” are indexed, speaking in terms of our EDMS:
After some time, the results are as follows (by default, the indexing job runs every 5 minutes):
We see that the number of documents has increased.
How to understand that the desired card is indexed?
• First, you need to make sure that the card type in Docsvision matches the data specified in the Elasticsearch settings.
• Secondly, wait for the array of cards to be indexed - when it gets into Docsvision, some time must pass before the data appears in the storage.
• Thirdly, you can search for a card by CardID. You can do this with a query:
If the card is in the storage, we will see its “raw” data, if not, we will see something like this response:
Searching for a card in an Elasticsearch node
Find a document by exact match of the Description field: http://localhost:9200/_search?q=description: Исходящий tv1
Result:
search for a document whose Description has an entry 'Incoming' http://localhost:9200/_search?q=description like Входящий
Result:
Search for a card by the content of the attached file http://localhost:9200/_search?q=content like ‘AGILE’
result:
Find all cards of document type: http://localhost:9200/_search?q=_type:CardDocument
or all cards of the task type: http://localhost:9200/_search?q=_type:CardTask
Using constructs and and the parameters that Elasticsearch gives in the form of JSON, you can collect such a request: http://localhost:9200/_search?q=_type:CardTask and Employee_RoomNumber: Орёл офиc and Employee_FirstName:Konstantin
It will show all cards of the task type, among the users who have FirstName = Konstantin, and located in the Oryol Office.
But LIKE there are other documented options:
unlike, fields, docs, content, etc.
All of them are described here.