2

When running the Sites 9 installElasticsearchIndexes.ps1 script, script does execute successfully if no params are specified. Documentation link is https://docs.sdl.com/LiveContent/content/en-US/SDL%20Tridion%20Sites-v1/GUID-C0549FC9-E15D-4A63-BE9A-16A7BC3ADFE4

When including the param --es-host SERVERNAME (.\installElasticSearchIndexes.ps1 --es-host HOSTNAME), I see an index creation error

ERROR com.sdl.delivery.iq.provider.elastic.connector.bootstrap.BootstrappedElasticSearchConnector 
- PUT http://SERVERNAME:9200/--es-hostudp-index: HTTP/1.1 400 Bad Request
{"error":{"root_cause":[{"type":"invalid_index_name_exception",
"reason":"Invalid index name [--es-hostudp-index], must not start with 
'_', '-', or '+'","index_uuid":"_na_","index":"--es-hostudp-index"}],
"type":"invalid_index_name_exception"

When also including the param --es-index-common-name-prefix (.\installElasticSearchIndexes.ps1 --es-host HOSTNAME --es-index-common-name-prefix udp2), I see an index NumberFormatException error relating to the elasticPort param

WARNING: Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'defaultConnectorConfig':
Unsatisfied dependency expressed through field 'elasticPort'; nested exception is org.springframework.beans.TypeMismatchException:
Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string:
"--es-index-common-name-prefix"

When using the params --es-port and --es-host (.\installElasticSearchIndexes.ps1 --es-host HOSTNAME --es-port 9200), a different NumberFormatException error is seen

Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'defaultConnectorConfig': Unsatisfied dependency expressed through field 'elasticPort'; 
nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; 
nested exception is java.lang.NumberFormatException: For input string: "--es-port" 
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588)

Should a different syntax be used for params? I've tried using double and single quotes for the param values. Again, script completes successfully with no params added.

1 Answer 1

7

The first error shows you are supplying the parameters in the incorrect format.

Hope below steps should work for you -

Make sure you have installed elastic search 5.5 or 5.6 version running. For windows environment use single hyphen (-). It should be like

.\installElasticSearchIndexes.ps1 -es-host "localhost" -es-port "9200" -es-scheme "http"

In this example, my elastic search is installed on my local machine and running on port 9200. You may use your hostname and elastic search port number on which it is running. enter image description here

Once you have successfully installed the index, You can verify it by using http://localhost:9200/_cat/indices?v URL in the browser.

1
  • 1
    My mistake, double hyphens for *nix, single hyphen for Windows... thanks.
    – Terry Kim
    Commented Jul 9, 2019 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.