As a navigational feature accessible through API, Elasticsearch can perform various kind of searches regardless of the data type. It helps to analyze billions of data in a few seconds and quickly find the best matches your query. Working with Elasticsearch Query API, you can use this URL https://api.nimvio.com to access the API. You may also require Environment ID and Content ID to do so.
By default, this API provides you with a default response structure. However, you are allowed to customize it as well. For more Elasticsearch documentation, you can refer to https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html. The following guides then will help you to work with each type of endpoint.
As a navigational feature accessible through API, Elasticsearch can perform various kind of searches regardless of the data type. It helps to analyze billions of data in a few seconds and quickly find the best matches your query. Working with Elasticsearch Query API, you can use this URL https://api.nimvio.com to access the API. You may also require Environment ID and Content ID to do so.
By default, this API provides you with a default response structure. However, you are allowed to customize it as well. For more Elasticsearch documentation, you can refer to https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html. The following guides then will help you to work with each type of endpoint.
You can retrieve the default response by setting the request body as blank. Below is the response example.
{
"status": 200,
"data": [
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-04-23T03:24:17.851Z",
"Data": {
"title": "New Blog"
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-10T06:21:28.079Z",
"Name": "Blog",
"PublishedAt": "2021-05-10T06:21:28.079Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_eaea0b46-f440-438c-9c26-92f4006ae03a"
},
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-05-11T06:48:59.021Z",
"Data": {
"title": "Nike "
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-11T06:49:27.439Z",
"Name": "Nike Air Max 2",
"PublishedAt": "2021-05-11T06:49:27.439Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_d06f972a-7ded-43a6-a1cb-25c92dd0ad67"
},
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-05-11T06:49:14.436Z",
"Data": {
"title": "Erian Content"
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-11T06:49:41.280Z",
"Name": "Erian Content",
"PublishedAt": "2021-05-11T06:49:41.280Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_b4ec1021-477e-4350-853e-cc27176250ff"
}
],
"totalItems": 3
}
This query will help you to return content based on a provided query string, using a parser with a strict syntax. The syntax is used to parse and split the provided query string based on operators, such as AND or NOT. The query then analyzes each split text independently before returning matching documents.
When running the following search, the query_string query splits (blue ocean) OR (red apple) into two parts: blue ocean and red apple. The content field’s analyzer then independently converts each part into tokens before returning matching documents.
{
"query":{
"query_string":{
"default_field":"Name",
"query":"(blue ocean) OR (red apple)"
}
}
}
The response will be as in the following example.
{
"status": 200,
"data": [
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-05-25T09:14:24.501Z",
"Data": {
"title": "Red Apple is sweet"
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-25T09:14:40.775Z",
"Name": "Red Apple",
"PublishedAt": "2021-05-25T09:14:40.775Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_82d01097-9f7a-4523-8756-9cbec95db3ba"
},
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-05-25T09:14:51.116Z",
"Data": {
"title": "Blue Ocean is wide"
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-25T09:15:08.184Z",
"Name": "Blue Ocean",
"PublishedAt": "2021-05-25T09:15:08.184Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_70eb05eb-5d63-4323-b9e5-725d8c1425b0"
}
],
"totalItems": 2
}
You can use the wildcard query to filter the contents. A wildcard operator is a placeholder that matches one or more characters; for example, the (*) wildcard operator matches zero or more characters. You can combine wildcard operators with other characters to create a wildcard pattern. Below is an example of the query.
The following search returns contents where the Name field contains a term that ends with ax. These matching terms can include Max.
{
"query":{
"bool":{
"filter" : [
{"wildcard": {"Name" : "*ax"}}
]
}
}
}
The response will be as in the following example.
{
"status": 200,
"data": [
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-05-12T08:23:28.523Z",
"Data": {
"title": "Nike Air"
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-12T08:23:40.079Z",
"Name": "Nike Air Max",
"PublishedAt": "2021-05-12T08:23:40.060Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_68c39452-b15a-4683-aff7-791e78f27f97"
},
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-05-12T08:25:36.621Z",
"Data": {
"title": "dddd"
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-25T06:59:18.278Z",
"Name": "Nike Air Max 5",
"PublishedAt": "2021-05-25T06:59:18.278Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_e51da2b1-9a85-48bf-8b56-85b40d08b51d"
},
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-05-11T06:48:59.021Z",
"Data": {
"title": "Nike "
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-11T06:49:27.439Z",
"Name": "Nike Air Max 2",
"PublishedAt": "2021-05-11T06:49:27.439Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_d06f972a-7ded-43a6-a1cb-25c92dd0ad67"
}
],
"totalItems": 3
}
By default, searches return the top 10 matching hits. The from parameter defines the number of hits to skip, defaulting to 0. The size parameter is the maximum number of hits to return. Together, these two parameters define a page of results. Below is an example of the query.
{
"from" : 2,
"size" : 5,
"query":{
"bool":{
"filter" : [
]
}
}
}
The response will be as in the following example.
{
"status": 200,
"data": [
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-05-12T08:25:06.164Z",
"Data": {
"title": "New Test"
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-12T08:25:13.280Z",
"Name": "New Test ",
"PublishedAt": "2021-05-12T08:25:13.280Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_823d64de-88d3-4b55-9c58-2bc540cc2848"
},
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-05-12T08:25:36.621Z",
"Data": {
"title": "dddd"
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-25T06:59:18.278Z",
"Name": "Nike Air Max 5",
"PublishedAt": "2021-05-25T06:59:18.278Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_e51da2b1-9a85-48bf-8b56-85b40d08b51d"
},
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-05-12T08:24:42.158Z",
"Data": {
"title": "New Catalog"
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-25T06:59:36.656Z",
"Name": "New Catalog",
"PublishedAt": "2021-05-25T06:59:36.656Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_97b48703-004d-410b-9ba6-f3a9a18a1e58"
},
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-05-25T07:02:06.798Z",
"Data": {
"title": "Elastic "
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-25T07:26:06.460Z",
"Name": "Elastic Search",
"PublishedAt": "2021-05-25T07:26:06.460Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_6c8753c7-3679-4c5b-b6ac-434ca8364723"
},
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-05-25T09:14:24.501Z",
"Data": {
"title": "Red Apple is sweet"
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-25T09:14:40.775Z",
"Name": "Red Apple",
"PublishedAt": "2021-05-25T09:14:40.775Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_82d01097-9f7a-4523-8756-9cbec95db3ba"
}
],
"totalItems": 5
}
The following request will search on the Title field inside the Data object.
{
"from" : 0,
"size" : 3,
"query":{
"bool":{
"filter" : [
{"wildcard": {"Data.title" : "*sweet*"}}
]
}
}
}
The response will be as in the following example.
{
"status": 200,
"data": [
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-05-25T09:14:24.501Z",
"Data": {
"title": "Red Apple is sweet"
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-25T09:14:40.775Z",
"Name": "Red Apple",
"PublishedAt": "2021-05-25T09:14:40.775Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_82d01097-9f7a-4523-8756-9cbec95db3ba"
}
],
"totalItems": 1
}
With this endpoint, you can get a list of content items with specific query parameters. The details are shown in the table below.
POST /cda/es/v1/{environment_id} |
||
Full URL https://api.nimvio.com/cda/es/v1/{environment_id} |
||
Path parameters |
Values |
Description |
environment_id |
Environment ID |
String Identifies the project |
Query parameters |
Values |
Description |
Name |
Content name |
String Use to request by specific content name |
TemplateName |
Content template name |
String Use to request by specific content template name |
Status |
Content status |
String Use to request by specific content status |
CreatedBy |
Content creator name |
String Use to request by specific content creator |
CreatedAt |
Content created date |
String Use to request by specific content created date |
Data |
Element or field of content |
String Use to request by specific content element or field |
PublishedBy |
Content published date |
String Use to request by specific content publisher |
UpdatedBy |
Content editor name |
String Use to request by specific content editor |
ContentID |
Content ID |
String Use to request by specific content ID |
TemplateID |
Template ID |
String Use to request by specific content template ID |
Page |
Page number |
String Use to request specific page |
PageSize |
Page size |
Int Use to request specific page Size |
Sort |
Field Name |
String Use to sort records based on field name |
SortAsc |
true or false |
Boolean Sort ascending when true and by default will sort descending |
Responses |
Fields |
Description |
|
status |
The HTTP response status |
|
data |
The content items’s system properties |
|
totalItems |
The total of content items |
|
data.Status |
The content items’s status |
|
data.CreatedBy |
The content items’s creator name |
|
data.CreatedAt |
The content items’s created date |
|
data.Data |
The content’s element or field with its value |
|
data.PublishedBy |
The content items’s publisher name |
|
data.UpdatedAt |
The content items’s updated date |
|
data.Name |
The content items’s name |
|
data.PublishedAt |
The content items’s published date |
|
data.UpdatedBy |
The content items’s editor name |
|
data.TemplateName |
The content items’s template name |
|
data.TemplateID |
The content items’s template ID |
|
data.ContentID |
The content items’s ID |
The below is a response example when using application/json as the content-type.
{
"status": 200,
"data": [
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-04-23T03:24:17.851Z",
"Data": {
"title": "New Blog"
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-10T06:21:28.079Z",
"Name": "Blog",
"PublishedAt": "2021-05-10T06:21:28.079Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_eaea0b46-f440-438c-9c26-92f4006ae03a"
}
],
"totalItems": 1
}
Congratulations! You have finished the guide. Keep exploring below: