
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
elasticSearch-collections
Advanced tools
Collections of ElasticSearch pyscripts for human
from elasticSearch_collections.elasticSearch_collections import ElasticSearchCollections
from typing import Dict, List
# Connect to es hosts
es = ElasticSearchCollections(["https://127.0.0.1"],
http_auth=("username", "password"),
ca_certs=False,
verify_certs=False,
timeout=600)
def fn_data_update(_data: List[Dict]):
actions = []
for i in _data:
# do something
action = {
"_op_type": "update",
"_index": i["_index"],
"_type": "_doc",
"_id": i["_id"],
"doc": {
# update logic
}
}
actions.append(action)
if actions:
es.bulk(actions)
es_search_info = {
"index": '_index',
"scroll": '1m',
"size": 1000,
"body": """{
"query": {
"match_all": {}
}
}""",
"timeout": "10m"
}
_res_list = es.scroll_source_generator(es_search_info)
# run multiple threads with threado
from threado.simple_thread_runner import SimpleThreadsRunner
# Define the num_workers and batch_size
# refer to https://github.com/AlexNg9527/threado
sr = SimpleThreadsRunner(fn=fn_data_update)
sr.run_threads(num_workers=10, iter_data=_res_list, batch_size=10)
# clear scroll_id
es.delete_scroll_id()
elasticSearch_collections is available on PyPI:
$ python -m pip install elasticSearch_collections
FAQs
Collections of ElasticSearch pyscripts for human
We found that elasticSearch-collections demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.