Skip to content

Instantly share code, notes, and snippets.

View ajosh0504's full-sized avatar

Apoorva Joshi ajosh0504

  • MongoDB
View GitHub Profile
@ajosh0504
ajosh0504 / session_summarization_queries.txt
Created July 12, 2023 19:09
session_summarization_queries
# 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="}},
@ajosh0504
ajosh0504 / import.py
Last active September 18, 2023 08:55
Code snippets associated with the <BLOG_NAME> blog.
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"