Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
Anyone Had Success With Specifying Elasticsearch Password To Api Server? I'Ve Tried Supplying It With Dynamic Config Variables But Pyhocon Doesn'T Support Tuples Afaik. So I Cannot Find Any Way To Create The Http_Auth Tuple In Elasticsearch() Create Api.

anyone had success with specifying elasticsearch password to api server?

I've tried supplying it with dynamic config variables but pyhocon doesn't support tuples AFAIK. So I cannot find any way to create the http_auth tuple in Elasticsearch() create API...

{hosts: [{host: " https://clearml-elasticsearch-es-http ", port: 9200}], args { timeout: 60 ││ , dead_timeout: 10, max_retries: 3, retry_on_timeout: true}, http_auth=("elastic", "passpasspass"), index_version: "1"}

SuccessfulKoala55 Any ideas?

  
  
Posted 3 years ago
Votes Newest

Answers 30


image

  
  
Posted 3 years ago

You should just do something like:
{hosts: ["clearml-elasticsearch-es-http"], args: { timeout: 60, dead_timeout: 10, max_retries: 3, retry_on_timeout: true, http_auth=["elastic", "passpasspass"], scheme="https", port=443, index_version: "1"}}

  
  
Posted 3 years ago

You're very welcome 🙂

  
  
Posted 3 years ago

ah let me try sth

  
  
Posted 3 years ago

so both list and tuple are supported...

  
  
Posted 3 years ago

Yes I see. But the current env doesn't reach there because it cannot be decoded by pyhocon.

  
  
Posted 3 years ago

no...

  
  
Posted 3 years ago

I'm using a simple pyhocon code to test it and it won't decode. So it won't reach the code to ovverride settings at all.

  
  
Posted 3 years ago

I changed them and tried some combinations to no avail...
I assume it should change the retry pattern too. but it doesn't change.. I feel I'm missing something obvious here

  
  
Posted 3 years ago

yes. Tuple is not valid. like json. only scalar, string, dict or array

  
  
Posted 3 years ago

curl works with the same url and creds from the container...

  
  
Posted 3 years ago

That's right

  
  
Posted 3 years ago

It's still not connecting XD
but parsing is successful 😄

  
  
Posted 3 years ago

wow man you're the best!
SuccessfulKoala55

  
  
Posted 3 years ago

Well, from the ES driver code:
if http_auth is not None: if isinstance(http_auth, (tuple, list)): http_auth = ":".join(http_auth)

  
  
Posted 3 years ago

nope no luck

  
  
Posted 3 years ago

It's still not connecting XD

Any info on why it's not connecting?

  
  
Posted 3 years ago

I'd try more variations, like trying to see if a different URL scheme in the host field helps:
{hosts: [" "], args: { timeout: 60, dead_timeout: 10, max_retries: 3, retry_on_timeout: true, http_auth=["elastic", "passpasspass"], scheme="https", port=443, index_version: "1"}}Also, note you're specifying port=433 - perhaps you need port 9200?

  
  
Posted 3 years ago

So I assume the only difference from a working setup is adding http_auth=(user,password) to the args section in the config

  
  
Posted 3 years ago

of course because the tuple is valid in Python.
but there's no way I can supply a tuple in the HOCON format (of json for that matter(

  
  
Posted 3 years ago

Hmm

  
  
Posted 3 years ago

there's no log of connecting to elasticsearch now 😕
does it mean it is okay?

the api server doesn't come up though. readiness probe fails.

  
  
Posted 3 years ago

Oh, you think the problem is tuple vs list?

  
  
Posted 3 years ago

Thanks!

  
  
Posted 3 years ago

What about trying:
{hosts: [" "], args: { timeout: 60, dead_timeout: 10, max_retries: 3, retry_on_timeout: true, http_auth=["elastic", "passpasspass"], index_version: "1"}}(of course, using the correct port - I used 9200 here, I'm not sure if you need 9200 or 443)

  
  
Posted 3 years ago

no. tried many variations. I'm not sure if it's reading the variable or not. because wait times don't change either

  
  
Posted 3 years ago

if it's parsing, the container will fail to start and you'll se an error in the log...

  
  
Posted 3 years ago

That wouldn't have crossed my mind especially when it's not in the docs.

  
  
Posted 3 years ago

it is indeed parsing because invalid hocon leads to error. but nothing changes about retry times etc

  
  
Posted 3 years ago

When I try it locally (with changes to the code), I can use auth if I inject args["http_auth"] = ("user", "password")

  
  
Posted 3 years ago
1K Views
30 Answers
3 years ago
8 months ago
Tags