API Reference / API Methods / MultiClusters / Search userID
Feb. 26, 2019

Search userID

Required API Key: Admin
Method signature
$client->searchUserIds(string query)

$client->searchUserIds(string query,[
  // All the following parameters are optional
  'clusterName' => string clusterName,
  'page' => integer page,
  'hitsPerPage' => integer hitsPerPage,
])

About this method

Search for userIDs.

The data returned will usually be a few seconds behind real-time, because userID usage may take up to a few seconds propagate to the different clusters.

To keep updates moving quicky, the index of userIDs isn’t built synchronously with the mapping. Instead, the index is built once every 12h, at the same time as the update of userID usage. For example, when you perform a modification like adding or moving a userID, the search will report an outdated value until the next rebuild of the mapping, which takes place every 12h.

Examples

Search userID

1
2
3
4
5
6
7
8
9
$page = 0;
$hitsPerPage = 12;

$client->searchUserIds('query', [
  // All the following parameters are optional
  'clusterName' => 'c1-test',
  'page' => $page,
  'hitsPerPage' => $hitsPerPage,
]);

Parameters

query
type: string
Required

Query to search. The search is a prefix search with typoTolerance. Use empty query to retrieve all users.

clusterName
type: string
default: null
Optional

If specified only clusters assigned to this cluster can be returned.

page
type: integer
default: 0
Optional

Page to fetch.

hitsPerPage
type: integer
default: 20
Optional

Number of users to return by page.

Response

In this section we document the JSON response returned by the API. Each language will encapsulate this response inside objects specific to the language and/or the implementation. So the actual type in your language might differ from what is documented.

JSON format

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
  "hits": [
    {
      "userID": "user9",
      "clusterName": "c11-test",
      "nbRecords": 3,
      "dataSize": 481,
      "objectID": "user9",
      "_highlightResult": {
        "userID": {
          "value": "<b>user<\/b>9",
          "matchLevel": "full",
          "fullyHighlighted": false,
          "matchedWords": [
            "user"
          ]
        },
        "clusterName": {
          "value": "c11-test",
          "matchLevel": "none",
          "matchedWords": []
        }
      }
    }
  ],
  "nbHits": 10,
  "page": 0,
  "hitsPerPage": 20,
  "updatedAt": 1514902377
}
hits
list of user object

List of user object matching the query.

nbHits
integer

Number of userIDs matching the query.

page
integer

Current page.

hitsPerPage
integer

Number of hits retrieved per page.

updatedAt
string

Timestamp of the last update of the index

hits ➔ user object

userID
string

userID of the requested user

clusterName
string

Cluster on which the data of the user is stored.

nbRecords
integer

Number of records this user has on the cluster

dataSize
integer

Data size taken by this user on the cluster

objectID
string

userID of the requested user. Same as userID.

_highlightResult

hits ➔ _highlightResult object

Highlighted attributes. Each attributes contains the following attributes:

value
string

Markup text with occurrences highlighted. The tags used for highlighting are specified via highlightPreTag and highlightPostTag.

matchLevel
string

Indicates how well the attribute matched the search query. Can be: none or partial or full. See search matchLevel for more details.

matchedWords
list

List of words from the query that matched the object.

fullyHighlighted
boolean

Whether the entire attribute value is highlighted.

Did you find this page helpful?