Jump to: navigation, search

Searching the UCS Database

Elasticsearch

Searches in the UCS database are generally performed using Elasticsearch 5.5 or higher. See here for more information.

Lucene

You can also search the UCS database by using the Lucene syntax described here.


Some samples follow.

 FirstName:kristin*

This query searches for all records having a key FirstName whose value is any word starting with "kristin."

 FirstName:Kim AND LastName:Brown AND EmailAddress:hotmail

This query searches on three attributes: FirstName containing "Kim," LastName containing "Brown," and EmailAddress containing "hotmail."

 Text:complain*

This query searches for all records having an attribute Text which contains words starting with "complain."

Important
The first character of the search should not be * (asterisk) or ? (question mark).


Making an Attribute Searchable from the Desktop

Procedures from UCS 8.x for making attributes searchable from the desktop no longer apply in UCS 9.1. It is no longer necessary to configure is-sortable and is-searchable on attributes. When an attribute is created in the Business Attributes, it becomes searchable.

You can now also specify as many searchable attributes as you want. Previously, you were limited to 10 interaction attributes of type string and 5 interaction attributes of type integer.

Using Index.Search to Search Interaction User Data

This example is based on user data named ReasonCode.

In UCS 8

Method=Search
Parameters={
	IndexName="interaction"
	Query="AllAttributes:"ReasonCode=Terminated""
}
Important
The syntax is specific to user data—it is not like any common interaction parameter (Subject, ContactId, MediaTypeId...).

In UCS 9

This query is still working but there is a more flexible usage—ReasonCode must be configured as a Business Attribute.

Service=Index
Method=Search
Parameters={
	IndexName="interaction"
	TenantId=1
	Query="ReasonCode:Terminated"
}
Important
  • The syntax is not specific, ReasonCode is used as any other interaction parameter.
  • The request must specify the TenantId to check the Business Attribute.

You can also use ReasonCode (or any parameter configured as an Interaction Attribute) in search criteria and sort criteria in InteractionListGet as shown in the following examples:

Using Elasticsearch queries

Example 1

Service=OMInteractions
Method=InteractionListGet
Parameters={ 
 TenantId=1
 ESQuery={
	"query":{
		"query_string":{
			"query":"Attributes.ReasonCode:T*"
		}
	},
	"sort":[
		{
			"Attributes.ReasonCode":{"order":"asc"}
		}
	]
 }
 AttributeList={
	AttrName=TConnectionId
	AttrName=PhoneNumber
	AttrName=ReasonCode
 }
}

Example 2

Service=OMInteractions
Method=InteractionListGet
Parameters={ 
 TenantId=1
 SearchCriteria={
	AttrName=ESQuery
	AttrValue={
		"query":{
			"query_string":{
				"query":"Attributes.ReasonCode:T*"
			}
		},
		"sort":[
			{
				"Attributes.ReasonCode":{"order":"asc"}
			}
		]
	}
 }
 AttributeList={
	AttrName=TConnectionId
	AttrName=PhoneNumber
	AttrName=ReasonCode
 }
}

Feedback

Comment on this article:

blog comments powered by Disqus
This page was last modified on May 18, 2018, at 07:01.