DSL query API endpoints

Get results for a DSL query

Summary

Execute a DSL query.

GET api/v1.3/search/dsl

Description

Execute a DSL query to perform a search.

Parameters

Parameter Description Required Type

search

The Helix Search DSL query URL encoded.

No

string

from

The pagination start position.

No

integer

size

The pagination size. For example, when set to 10, you will only see 10 results per page.

No

integer

Example usage

curl -X GET --location "http://localhost:1601/api/v1.3/search/dsl?search=ext%3A+mp3+wav+%2Bmodel%3A+asset"
-H "Authorization: Bearer <JWT>" \
-H "Content-Type: application/json"

Helix Search responds with:

{
  "took": 174,
  "timed_out": false,
  "_shards": {
    "failed": 0.0,
    "successful": 1.0,
    "total": 1.0,
    "skipped": 0.0
  },
  "hits": {
    "total": {
      "relation": "eq",
      "value": 847
    },
    "hits": [
      {
        "_index": "perforce1",
        "_id": "change-917081",
        "_score": null,
        "_source": {
        "type": "change",
        "change": 917081,
        "date": 1179756208000,
        "client": "tony-barney-dev",
        "user": "tony",
        "restricted": false,
        "description": "Add P4Perl 3.5943 sources to depot as basis for the first
                        productized version of P4Perl.
        "depotFile": "//depot/main/p4-perl/...",
        "indexDate": 0
      },
      "sort": [ 
        -9223372036854775808
      ]
     }, ......    ],
   "max_score": null
  },
  "terminated_early": false
}

If a request fails

<error code>:

  • 400 DSL parsing error or Elastic bad requests

  • 401 Unauthorized

Get autocomplete suggestions for a DSL keyword

Summary

Get a list of values for a DSL keyword.

GET api/v1.3/autocomplete/{term}

Description

Get a list of values for a DSL keyword to perform a search.

Parameters

Parameter Description Required Type

term

The DSL keyword for which you want autocomplete values. For example, user.

Yes

string

prefix

The DSL value prefix.

No

string

size

The size of the dropdown list. For example, when set to 10, you will only see 10 values in the dropdown list.

No

integer

sort

The order in which you want to sort the DSL values. The following values are accepted:

  • popular: The most popular DSL value is presented at the top of the dropdown list.

  • alpha: The DSL values are sorted alphabetically.

No

sort

Example usage

curl -X GET --location "http://localhost:1601/api/v1.3/autocomplete/user"
-H "Content-Type: application/json" \
-H "Authorization: Bearer <JWT>"

Helix Search responds with:

{
  "status": {
    "code": 200,
    "message": "OK"
  },
  "data": [
    "Font",
    "Circle",
    "Electric blue",
    "Pattern",
    "Logo",
    "Symbol",
    "Graphics",
    "Symmetry",
    "Rectangle",
    "Brand"
  ]
}

If a request fails

<error code>:

  • 400 DSL term error or prefix limits.

  • 401 Unauthorized

Populate DSL autocomplete cache

Summary

Query Elasticsearch for DSL values and populate cache.

PUT api/v1.3/autocomplete/{term}

Description

Query Elasticsearch for DSL values and populate cache.

Parameters

Parameter Description Required Type

term

The DSL keyword for which you want autocomplete values. For example, user.

Yes

string

Example usage

curl -X PUT --location "http://localhost:1601/api/v1.3/autocomplete/detected"
-H "Content-Type: application/json" \
-H "Authorization: Bearer <JWT>"

Helix Search responds with:

{
  "status": {
    "code": 200,
    "message": "OK"
  },
  "data": [
    "total": 39
  ]
}

If a request fails

<error code>:

  • 400 DSL term error or prefix limits.

  • 401 Unauthorized

Clear DSL autocomplete cache

Summary

Clear all cached DSL values for a term.

DELETE api/v1.3/autocomplete/{term}

Description

Clear all cached DSL values for the specified term.

Parameters

Parameter Description Required Type

term

The DSL keyword for which you want autocomplete values. For example, user.

Yes

string

Example usage

curl -X DELETE --location "http://localhost:1601/api/v1.3/autocomplete/user"
-H "Content-Type: application/json" \
-H "Authorization: Bearer <JWT>"

Helix Search responds with:

{
  "status": {
    "code": 200,
    "message": "OK"
  }
}

If a request fails

<error code>:

  • 400 DSL term error or prefix limits.

  • 401 Unauthorized

For more information about the DSL API endpoint, see Access the Swagger REST API .