Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

182
Views
¿Cuál es el equivalente de Elasticsearch-py a las acciones de alias?

Estoy tratando de implementar un enfoque de índices múltiples usando elasticsearch-dsl . Básicamente hay dos pasos:

1. Crear alias:

 PUT /tweets_1/_alias/tweets_search PUT /tweets_1/_alias/tweets_index

2. Cambie el alias cuando sea necesario:

 POST /_aliases { "actions": [ { "add": { "index": "tweets_2", "alias": "tweets_search" }}, { "remove": { "index": "tweets_1", "alias": "tweets_index" }}, { "add": { "index": "tweets_2", "alias": "tweets_index" }} ] }

Solo pude implementar el paso 1 usando elasticsearch-py (no el dsl):

 from elasticsearch.client import IndicesClient IndicesClient(client).("tweets_1", "tweets_search") IndicesClient(client).("tweets_1", "tweets_index")

No tengo idea de cómo hacer eso para el paso 2. Entonces, ¿cuál sería el equivalente en elasticsearch-dsl (o al menos en elasticsearch-py)?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Para implementar eso necesitas usar elasticsearch-py :

 from elasticsearch import Elasticsearch es = Elasticsearch() # use es.indices instead of instantiating IndicesClient es.indices.put_alias(index='tweets_1', name='tweets_search') es.indices.put_alias(index='tweets_1', name='tweets_index') es.indices.update_aliases({ "actions": [ { "add": { "index": "tweets_2", "alias": "tweets_search" }}, { "remove": { "index": "tweets_1", "alias": "tweets_index" }}, { "add": { "index": "tweets_2", "alias": "tweets_index" }} ] })
over 4 years ago · Santiago Trujillo Report

0

index_list_for_realias = [...] aliases_list_to_realias = [...] for i in index_list_for_realias: print(i) for j in aliases_list_to_realias: es.indices.put_alias(index=i, name="logstash5-uni-" + j, body={ "filter": { "term": { "uni": j } } } )
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!