Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61541905
esoperations.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, May 7, 08:04
Size
681 B
Mime Type
text/x-python
Expires
Thu, May 9, 08:04 (2 d)
Engine
blob
Format
Raw Data
Handle
17525798
Attached To
R11586 sausage-api
esoperations.py
View Options
# © All rights reserved. ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE,
# Switzerland
# SCITAS - Scientific IT and Application Support, 2021
# See the LICENSE.txt file for more details.
import
importlib
for
mname
in
[
'elasticsearch'
,
'elasticsearch6'
]:
es_spec
=
importlib
.
util
.
find_spec
(
mname
)
if
es_spec
is
not
None
:
esmodule
=
importlib
.
import_module
(
mname
)
break
class
ESOp
:
def
__init__
(
self
,
server
):
self
.
server
=
esmodule
.
Elasticsearch
([
server
])
def
esget
(
self
,
index
,
doc
):
try
:
response
=
self
.
server
.
search
(
index
=
index
,
body
=
doc
)
return
response
except
BaseException
:
return
""
Event Timeline
Log In to Comment