X-pack\..\elasticsearch-env.bat"' is not recognized as an internal or external command

Hello everyone,

I am trying to install the x_pack on elasticsearch i've followed every instructions in this guide
I set up the elasticsearch.yml file as it says , I restart elasticsearch and in one line I get this:

[2017-12-07T09:36:35,987][ERROR][o.e.x.m.c.i.IndexStatsCollector] [9njwqLj] collector [index-stats] failed to collect data
org.elasticsearch.cluster.block.ClusterBlockException: blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized];
at org.elasticsearch.cluster.block.ClusterBlocks.globalBlockedException(ClusterBlocks.java:165) ~[elasticsearch-6.0.0.jar:6.0.0]
"it repeats the same mistake (at org.elasticsearch.something) until "

[2017-12-07T09:36:38,091][INFO ][o.e.l.LicenseService ] [9njwqLj] license [2b51a185-1182-4c86-a424-91ef909b99d9] mode [trial] - valid
[2017-12-07T09:36:38,129][INFO ][o.e.g.GatewayService ] [9njwqLj] recovered [7] indices into cluster_state
[2017-12-07T09:36:47,981][INFO ][o.e.c.m.MetaDataCreateIndexService] [9njwqLj] [.monitoring-es-6-2017.12.07] creating index, cause [auto(bulk api)], templates [.monitoring-es], shards [1]/[1], mappings [doc]
[2017-12-07T09:36:51,285][INFO ][o.e.c.r.a.AllocationService] [9njwqLj] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[my-index][3], [.kibana][0], [.monitoring-es-6-2017.12.07][0]] ...]).
[2017-12-07T09:37:51,523][INFO ][o.e.c.m.MetaDataCreateIndexService] [9njwqLj] [.watcher-history-6-2017.12.07] creating index, cause [auto(bulk api)], templates [.watch-history-6], shards [1]/[1], mappings [doc]
[2017-12-07T09:37:52,697][INFO ][o.e.c.m.MetaDataMappingService] [9njwqLj] [.watcher-history-6-2017.12.07/Hlt05ZPKQcqWWAXIJKJ9Xg] update_mapping [doc]
[2017-12-07T09:37:53,071][INFO ][o.e.c.m.MetaDataMappingService] [9njwqLj] [.watcher-history-6-2017.12.07/Hlt05ZPKQcqWWAXIJKJ9Xg] update_mapping [doc]

And it stop right there, So i continued to the next step , and execute this command:

\bin\x-pack>setup-passwords interactive

And i get this :

'"C:\Program Files\Elastic\Elasticsearch\6.0.0\bin\x-pack..\elasticsearch-env.bat"' is not recognized as an internal or external command, operable program or batch file.

In an other topic it says that the x-pach-env.bat was missing but I checked and it's there.

Could you help me please

Best Regards



Are you running this on windows?

If so, you need to run setup-passwords.bat instead of setup-passwords.

yes I am on windows , i have the same results "C:\Program Files\Elastic\Elasticsearch\6.0.0\bin\x-pack..\elasticsearch-env.bat"' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.

Can you paste the content of your setup-passwords.bat here?

@echo off

setlocal enabledelayedexpansion
setlocal enableextensions

call "%~dp0..\elasticsearch-env.bat" || exit /b 1

call "%~dp0x-pack-env.bat" || exit /b 1

%JAVA% ^
-Des.path.home="%ES_HOME%" ^
-Des.path.conf="%ES_PATH_CONF%" ^
-cp "%ES_CLASSPATH%" ^
org.elasticsearch.xpack.security.authc.esnative.tool.SetupPasswordTool ^


Everything looks good in there, it's the same as mine that works. Did you install Elasticsearch via the MSI package?

No when i tried to install via the msi package it returns an error occured so i installed it with the zip file

I'm trying to reproduce that error locally now. In the meantime, can you confirm that you followed the same steps that I usually do:

  1. From the bin folder of elasticsearch I run: elasticsearch-plugin.bat install x-pack
  2. After that is done, i start Elasticsearch (from elasticsearch.bat in the case of the zip version)
  3. From the bin\x-pack folder I run setup-passwords.bat interactive

After this it should work just fine. And it shouldn't matter if you do it from Cmd or Powershell.

So i install x-pack on elasticsearch and kibana with this command elasticsearch-plugin.bat install x-pack the same with kibana kibana-plugin.bat install x-pack

then i generate certificate certgen command i save it into the config directory
then i modified the elasticsearch.yml and add those line :
xpack.ssl.key: certs/${node.name}/${node.name}.key (path to my certificate)
xpack.ssl.certificate: certs/${node.name}/${node.name}.crt
xpack.ssl.certificate_authorities: certs/ca/ca.crt
xpack.security.transport.ssl.enabled: true

after that i restarted elasticsearch end execute the setup_passwords command

I can't manage to reproduce this issue locally. Can you give more details on it?
I tried with 6.0.1 and Windows Server 2012 and Windows 10, with both the MSI and the zip package.

Can you also make sure that elasticsearch-env.bat is present in the bin folder of Elasticsearch?
If you unzip Elasticsearch again in a new place and do the steps that I mentioned, does it work?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.