Documentation Center

Configuring the locations of the Discovery Service and IQ Query Service in the Java/JSP web application

To enable the IQ Query Client to connect to the Discovery Service (and the Capabilities it exposes) to be found, configure the location of the Discovery Service in the search client configuration file, udp-search-conf.xml.

Procedure

  1. In the configuration directory of the web application, open udp-search-conf.xml for editing.
  2. Ensure that the file contains a root-level element called ServiceConfig, for example, the following one:
    <ServiceConfig
      Version="10.0"
      xsi:noNamespaceSchemaLocation="schemas/udp-search-conf.xsd"
      ConnectionTimeout="${indexconnectiontimeout:-10000}"
      ReadTimeout="${indexreadtimeout:-30000}"
      WriteTimeout="${indexwritetimeout:-30000}"
      MaxIdleConnection="${indexmaxidleconnections:-30}"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <DiscoveryService ServiceUri="${discoveryurl:-http://localhost:8082/discovery.svc" />
      <TokenService ClientId="${clientid:-cduser}" ClientSecret="${clientsecret:-encrypted:PASSWORD}" />

    where PASSWORD is the encrypted password that cduser uses to connect to the Discovery Service

  3. Only if you are using the Search feature without using the Discovery Service, uncomment the QueryService element, and configure the URL of the IQ Query Service endpoint separately in its ServiceUri attribute.
  4. If your Elasticsearch index for Content Delivery content does not have the default name, udp-index, set the custom index name in the IndexName attribute of the DefaultIndex element.
  5. The udp-search-conf.xml that ships with your product is set up to support the Java class com.sdl.delivery.iq.query.client.rest.RestQueryClient for querying. Use this class if your client communicates with Elasticsearch through the IQ Query Service from Content Delivery, rather than directly. Alternatively, if your client communicates directly with Elasticsearch, in the QueryClient element, change the Class attribute to the value com.sdl.delivery.iq.query.client.embedded.EmbeddedQueryClient.
  6. If you are connecting to Elasticsearch directly, also create a child section to the QueryClient element and call it QueryProvider, with a Type attribute set to the value elasticsearch. Then create a child element to QueryProvider and call it Properties. Within this Properties section, add multiple Property child elements, each with a Name attribute and a Value attribute, configured as follows:
    Name valueDescription of Value value
    es.hostThe Elasticsearch host name
    es.portThe Elasticsearch port number (you can omit this property if the value is 9200)
    es.ingest.hostThe Elasticsearch ingest node host name
    es.ingest.portThe Elasticsearch ingest node port number (you can omit this property if the value is 9200)
    es.usernameIf you use Basic Authentication (typical when connecting to Elastic Cloud), a valid username for accessing the Elasticsearch instance
    es.passwordIf you use Basic Authentication (typical when connecting to Elastic Cloud), a valid password for the username provided above
    es.ingest.usernameIf you use Basic Authentication (typical when connecting to Elastic Cloud), a valid username for accessing the Elasticsearch ingest node
    es.ingest.passwordIf you use Basic Authentication (typical when connecting to Elastic Cloud), a valid password for the username provided above
  7. Save and close udp-search-conf.xml.