This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Select important fields to extract from session logs | |
# Get top 10 unique values for each of the fields, and a representative document for each unique value | |
# Sample query on Infosec cluster: | |
GET logs-*/_search | |
{ | |
"query":{ | |
"bool": { | |
"must": [ | |
{"match": {"host.os.type": "linux"}}, | |
{"match": {"process.session_leader.entity_id": "ODBjMTU4YmEtZDkzYy00YTU2LTg5MGItZjZhZGViM2JlNmQ5LTUyOTEwLTE2ODYxNjE2ODU="}}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import elasticsearch import Elasticsearch | |
from pathlib import Path | |
from eland.ml.pytorch import PyTorchModel | |
from eland.ml.pytorch.transformers import TransformerModel | |
# Load the custom model | |
tm = TransformerModel("model", "text_classification") | |
# Export the model to a TorchScript representation which Elasticsearch uses | |
tmp_path = "models" |