If I enable xpack , Elasticsearch stops working and my license won't work

I have been having an issue viewing the Kibana login page. Since the update to 7x for Elasticsearch and Kibana, I have not been able to access the login page nor has it been prompted for me. Is there any way that this can be solved??

Are you sure that Elasticsearch security is enabled?

You can try using curl or just your browser (from an incognito tab, for example) to access your Elasticsearch cluster and see if you get a user/password prompt or an error if you are using curl

You should see something like this:

$ curl http://localhost:9200
{"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}

If instead you get something like this you need to enable the security plugin.

➜ curl http://localhost:9200
{
  "name" : "a",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "uOt8401ySMW5VAgrDGl8_g",
  "version" : {
    "number" : "7.9.1-SNAPSHOT",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "83a0fbd382623d5aa2d9ac8abcfa21dc57278605",
    "build_date" : "2020-09-02T19:31:56.319403Z",
    "build_snapshot" : true,
    "lucene_version" : "8.6.2",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

You can also try to use the Security API and see if those endpoints are working for you like

GET /_security/privilege
GET /_security/user

if I enable xpack , Elasticsearch stops working and my license won't work.

Sorry to hear that, I've moved this thread to the Elasticsearch forum, used your sentence as title, and added the stack-security tag, since that's the source of your isssue.

Have you checked the elasticsearch logs for any errors?

yeah there is literally no errors right now , just the shards fail everyday due to index.max_docvalue_fields_search being less than 200. which I am also trying to fix. However , I know that it will fail as soon as I turn xpack to enabled

We're happy to help sort this out, but we'll need more information.

There's a lot of non-specific information like an issue viewing the Kibana login page and Elasticsearch stops working but in order to help we need details.

Something like

If I change the x.y.z setting to true in my something.conf config file, then when I try to run thingo it fails with the error message Please don't do that.

The more specific you are, the easier it is for us to help and the more likely we are to solve it.

okay thank you ,
The initial problem was that if I open Kibana through url it will not prompt me with a login. your colleague then suggested enabling the security. So now , when I updated Elasticsearch to 7x I was having a problem with xpack security and the user password. my license was not being recognised or being added into Kibana too. I then realised xpack was the issue by turning it to false everything started working.

I would show more to you but I haven't turned the xpack to enabled incase of failure. could u tell me what you would prefer me to show you.

I do not get a password prompt when using curl

In order to help you, I need the sort of details that I mentioned in my previous reply.
That's not a preference, I simply cannot offer you any useful advice unless I have specific details about the problem you are facing.

It's entirely up to you whether you want to do that, but there's nothing I can do for you without it.

okay I see at the time I didn't do anything so I couldn't show u but I have changed the Security.

14720]: {"type":"log","@timestamp":"2020-09-22T12:42:57Z","tags":["warning","plugins","alerts","plugins","alerting"],"pid":14720,"message":"APIs are disabled due to the Encrypted Saved Objects plugin using an ephemeral encryption key. Please set xpack.encryptedSavedObjects.encryptionKey in kibana.yml."}
4720]: {"type":"log","@timestamp":"2020-09-22T12:42:58Z","tags":["info","plugins","monitoring","monitoring"],"pid":14720,"message":"config sourced from: production cluster"}
Sep 22 12:42:58 [14720]: {"type":"log","@timestamp":"2020-09-22T12:42:58Z","tags":["info","plugins","reporting","config"],"pid":14720,"message":"Chromium sandbox provides an additional layer of protection, and is supported for Linux Ubuntu S. Automatically enabling Chromium sandbox."}
Sep 22 12:42:58 [14720]: {"type":"log","@timestamp":"2020-09-22T12:42:58Z","tags":["warning","plugins","licensing"],"pid":14720,"message":"License information could not be obtained from Elasticsearch due to [security_exception] unable to authenticate user [elastic] for REST request [/_xpack], with { header={ WWW-Authenticate=\"Basic realm=\\\"security\\\" charset=\\\"UTF-8\\\"\" } } :: {\"path\":\"/_xpack\",\"statusCode\":401,\"response\":\"{\\\"error\
Sep 22 12:42:58 14720]: {"type":"log","@timestamp":"2020-09-22T12:42:58Z","tags":["warning","plugins","monitoring","monitoring"],"pid":14720,"message":"X-Pack Monitoring Cluster Alerts will not be available: [security_exception] unable to authenticate user [elastic] for REST request [/_xpack], with { header={ WWW-Authenticate=\"Basic realm=\\\"security\\\" charset=\\\"UTF-8\\\"\" } }"}
Sep 22 12:42:58 4720]: {"type":"log","@timestamp":"2020-09-22T12:42:58Z","tags":["warning","plugins","licensing"],"pid":14720,"message":"License information could not be obtained from Elasticsearch due to [security_exception] unable to authenticate user [elastic] for REST request [/_xpack], with { header={ WWW-Authenticate=\"Basic realm=\\\"security\\\" charset=\\\"UTF-8\\\"\" } } :: {\"path\":\"/_xpack\",\"statusCode\":401,\"response\":\"{\\\"error\
Sep 22 12:42:58 720]: {"type":"log","@timestamp":"2020-09-22T12:42:58Z","tags":["info","savedobjects-service"],"pid":14720,"message":"Waiting until all Elasticsearch nodes are compatible with Kibana before starting saved objects migrations..."}
Sep 22 12:42:58 4720]: {"type":"log","@timestamp":"2020-09-22T12:42:58Z","tags":["error","savedobjects-service"],"pid":14720,"message":"Unable to retrieve version information from Elasticsearch nodes."}
Sep 22 12:43:28 4720]: {"type":"log","@timestamp":"2020-09-22T12:43:28Z","tags":["warning","plugins","licensing"],"pid":14720,"message":"License information could not be obtained from Elasticsearch due to [security_exception] unable to authenticate user [elastic] for REST request [/_xpack], with { header={ WWW-Authenticate=\"Basic realm=\\\"security\\\" charset=\\\"UTF-8\\\"\" } } :: {\"path\":\"/_xpack\",\"statusCode\":401,\"response\":\"{\\\"error\

This is the error that comes up in Kibana logs when I enable xpack

I have resolved the issue. thank you