Unable to add key-value pair to keystore from command-line

In ES 6.8:

I'm unable to add a key-value pair from command-line using keystore:

/usr/share/elasticsearch/bin/elasticsearch-keystore add -E "foo=bar"

ERROR: The setting name can not be null.

What could I be missing? I'm able to add /usr/share/elasticsearch/bin/elasticsearch-keystore add foo though and it prompts for the value.

Hi there @sandeepkanabar,

-E is available in all elasticsearch-x CLI tools and is for configuring settings for the environment such as system properties. This is not specific to elasticsearch-keystore and cannot be used to add/set keystore settings.

bin/elasticsearch-keystore add foo 

is the proper way to add setting thefoosetting to your keystore.

If you don't want to be prompted, then you can use the --stdin option and cat a file or echo a string and pipe that into the bin/elasticsearch-keystore command, see more in our docs

1 Like

Yeah thanks. I made use of the echo foo-string | bin/elasticsearch-keystore and got it working. I only asked about this because if you run the command bin/elasticsearch-keystore add -h then the very first option that appears is -E.

[root@foohost ~]# /usr/share/elasticsearch/bin/elasticsearch-keystore add -h
Add a string setting to the keystore

Non-option arguments:
setting name

Option             Description
------             -----------
-E <KeyValuePair>  Configure a setting
-f, --force        Overwrite existing setting without prompting
-h, --help         show help
-s, --silent       show minimal output
-v, --verbose      show verbose output
-x, --stdin        Read setting value from stdin

Yeap, and as I mentioned above

I get that both things are settings and this might get confusing for users. I'll follow up and see if we can change the -E message to something also generic which doesn't clash semantically with elasticsearch-x tools.

Thanks for the feedback

1 Like

Thank you very much :+1:.

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