%global _empty_manifest_terminate_build 0 Name: python-exec-es Version: 0.0.11 Release: 1 Summary: ElasticSearch Handler License: MIT License URL: https://github.com/Supplayer/exec_es.git Source0: https://mirrors.nju.edu.cn/pypi/web/packages/18/c1/817617036167a10534c8c67a3d1432fe4a9a84a9ff76578dea04e4ce832f/exec-es-0.0.11.tar.gz BuildArch: noarch Requires: python3-elasticsearch Requires: python3-requests %description # exec_es exec_es 对ElasticSearch进行了二次开发,针对多开发环境数据写入,以及bulk进行了优化。 ## Installation 1.使用python包管理工具 [pip](https://pypi.org/project/exec-es/) 进行安装。 ```bash pip install exec-es ``` ## Usage ```python from execelasticsearch import ExecES, ClientConfig, MappingMethod # MappingData.SearchBody.update will change defult Search Body Template, use before ExecES init. MappingMethod.SearchBody.update('match', 'match', {"<>": {"query": "<>"}}) dt_config = ClientConfig(hosts=[{'host': "172.28.0.1"}]) dp_config = ClientConfig(hosts=[{'host': "172.28.0.2"}], doc_type='your_tags') es_clients = ExecES(dt=dt_config, dp=dp_config) index = 'exec_es_test' hosts = ["dt", "dp"] def es_create(data_, dex=0): data_ = data_[dex] print(es_clients.create(index, data_['id'], data_, hosts)) def es_update(data_, dex=0): data_ = data_[dex] data_['account_score'] = 10 print(es_clients.update(index, data_['id'], data_, hosts)) def es_delete(id_): print(es_clients.delete(index, id_, hosts)) def es_update_or_ignore(data_, dex=0): data_ = data_[dex] print(es_clients.update_or_ignore(index, data_['id'], data_, hosts)) def es_upsert(data_, dex=0): data_ = data_[dex] print(es_clients.upsert(index, data_['id'], data_, hosts)) def es_bulk_upsert(data_): data_[0]['account_score'] = 10 print(es_clients.bulk_upsert(index, data_, hosts)) def es_bulk_delete(data_): ids = [i['id'] for i in data_] print(es_clients.bulk_delete(index, ids, hosts)) def es_mget(data_, _source_includes=None): ids = [i['id'] for i in data_] print(es_clients.mget(index, ids, hosts, _source_includes=_source_includes)) def es_exists(ids: list): print(es_clients.exists_ids(index, ids, hosts)) search_b = es_clients.search_body search_b.update(body_type1={"query": {"bool": {"must": {"exists": {"field": "<>"}}}}}) search_b["body_type2"] = {"query": {"bool": {"must": {"exists": {"field": "<>"}}}}} print(search_b.body_type_list) # show default body_type list def es_search(body_kwargs: dict = None): res = es_clients.search(index, body_kwargs or {'match': dict(field='id', value=1)}, 'dt') for i in res: print(i) def es_original_func(): print(es_clients['dt'].ping()) if __name__ == '__main__': es_original_func() ``` ## Contributing 使用前请做适当的测试,以确定跟您的项目完全兼容。 ## License [MIT](https://choosealicense.com/licenses/mit/) %package -n python3-exec-es Summary: ElasticSearch Handler Provides: python-exec-es BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-exec-es # exec_es exec_es 对ElasticSearch进行了二次开发,针对多开发环境数据写入,以及bulk进行了优化。 ## Installation 1.使用python包管理工具 [pip](https://pypi.org/project/exec-es/) 进行安装。 ```bash pip install exec-es ``` ## Usage ```python from execelasticsearch import ExecES, ClientConfig, MappingMethod # MappingData.SearchBody.update will change defult Search Body Template, use before ExecES init. MappingMethod.SearchBody.update('match', 'match', {"<>": {"query": "<>"}}) dt_config = ClientConfig(hosts=[{'host': "172.28.0.1"}]) dp_config = ClientConfig(hosts=[{'host': "172.28.0.2"}], doc_type='your_tags') es_clients = ExecES(dt=dt_config, dp=dp_config) index = 'exec_es_test' hosts = ["dt", "dp"] def es_create(data_, dex=0): data_ = data_[dex] print(es_clients.create(index, data_['id'], data_, hosts)) def es_update(data_, dex=0): data_ = data_[dex] data_['account_score'] = 10 print(es_clients.update(index, data_['id'], data_, hosts)) def es_delete(id_): print(es_clients.delete(index, id_, hosts)) def es_update_or_ignore(data_, dex=0): data_ = data_[dex] print(es_clients.update_or_ignore(index, data_['id'], data_, hosts)) def es_upsert(data_, dex=0): data_ = data_[dex] print(es_clients.upsert(index, data_['id'], data_, hosts)) def es_bulk_upsert(data_): data_[0]['account_score'] = 10 print(es_clients.bulk_upsert(index, data_, hosts)) def es_bulk_delete(data_): ids = [i['id'] for i in data_] print(es_clients.bulk_delete(index, ids, hosts)) def es_mget(data_, _source_includes=None): ids = [i['id'] for i in data_] print(es_clients.mget(index, ids, hosts, _source_includes=_source_includes)) def es_exists(ids: list): print(es_clients.exists_ids(index, ids, hosts)) search_b = es_clients.search_body search_b.update(body_type1={"query": {"bool": {"must": {"exists": {"field": "<>"}}}}}) search_b["body_type2"] = {"query": {"bool": {"must": {"exists": {"field": "<>"}}}}} print(search_b.body_type_list) # show default body_type list def es_search(body_kwargs: dict = None): res = es_clients.search(index, body_kwargs or {'match': dict(field='id', value=1)}, 'dt') for i in res: print(i) def es_original_func(): print(es_clients['dt'].ping()) if __name__ == '__main__': es_original_func() ``` ## Contributing 使用前请做适当的测试,以确定跟您的项目完全兼容。 ## License [MIT](https://choosealicense.com/licenses/mit/) %package help Summary: Development documents and examples for exec-es Provides: python3-exec-es-doc %description help # exec_es exec_es 对ElasticSearch进行了二次开发,针对多开发环境数据写入,以及bulk进行了优化。 ## Installation 1.使用python包管理工具 [pip](https://pypi.org/project/exec-es/) 进行安装。 ```bash pip install exec-es ``` ## Usage ```python from execelasticsearch import ExecES, ClientConfig, MappingMethod # MappingData.SearchBody.update will change defult Search Body Template, use before ExecES init. MappingMethod.SearchBody.update('match', 'match', {"<>": {"query": "<>"}}) dt_config = ClientConfig(hosts=[{'host': "172.28.0.1"}]) dp_config = ClientConfig(hosts=[{'host': "172.28.0.2"}], doc_type='your_tags') es_clients = ExecES(dt=dt_config, dp=dp_config) index = 'exec_es_test' hosts = ["dt", "dp"] def es_create(data_, dex=0): data_ = data_[dex] print(es_clients.create(index, data_['id'], data_, hosts)) def es_update(data_, dex=0): data_ = data_[dex] data_['account_score'] = 10 print(es_clients.update(index, data_['id'], data_, hosts)) def es_delete(id_): print(es_clients.delete(index, id_, hosts)) def es_update_or_ignore(data_, dex=0): data_ = data_[dex] print(es_clients.update_or_ignore(index, data_['id'], data_, hosts)) def es_upsert(data_, dex=0): data_ = data_[dex] print(es_clients.upsert(index, data_['id'], data_, hosts)) def es_bulk_upsert(data_): data_[0]['account_score'] = 10 print(es_clients.bulk_upsert(index, data_, hosts)) def es_bulk_delete(data_): ids = [i['id'] for i in data_] print(es_clients.bulk_delete(index, ids, hosts)) def es_mget(data_, _source_includes=None): ids = [i['id'] for i in data_] print(es_clients.mget(index, ids, hosts, _source_includes=_source_includes)) def es_exists(ids: list): print(es_clients.exists_ids(index, ids, hosts)) search_b = es_clients.search_body search_b.update(body_type1={"query": {"bool": {"must": {"exists": {"field": "<>"}}}}}) search_b["body_type2"] = {"query": {"bool": {"must": {"exists": {"field": "<>"}}}}} print(search_b.body_type_list) # show default body_type list def es_search(body_kwargs: dict = None): res = es_clients.search(index, body_kwargs or {'match': dict(field='id', value=1)}, 'dt') for i in res: print(i) def es_original_func(): print(es_clients['dt'].ping()) if __name__ == '__main__': es_original_func() ``` ## Contributing 使用前请做适当的测试,以确定跟您的项目完全兼容。 ## License [MIT](https://choosealicense.com/licenses/mit/) %prep %autosetup -n exec-es-0.0.11 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-exec-es -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Thu May 18 2023 Python_Bot - 0.0.11-1 - Package Spec generated