Skip to content

Instantly share code, notes, and snippets.

View martijnvg's full-sized avatar

Martijn van Groningen martijnvg

  • Elastic
  • Hoofddorp
View GitHub Profile
@martijnvg
martijnvg / baseline3_cpu_profile_10.html
Created May 27, 2025 07:52
Heavy stored field decompressions
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<style>
body {margin: 0; padding: 10px 10px 22px 10px; background-color: #ffffff}
h1 {margin: 5px 0 0 0; font-size: 18px; font-weight: normal; text-align: center}
header {margin: -24px 0 5px 0; line-height: 24px}
button {font: 12px sans-serif; cursor: pointer}
p {position: fixed; bottom: 0; margin: 0; padding: 2px 3px 2px 3px; outline: 1px solid #ffc000; display: none; overflow: hidden; white-space: nowrap; background-color: #ffffe0}
@martijnvg
martijnvg / text-field-synthetic-source.patch
Last active March 14, 2024 16:00
text-field-synthetic-source
Subject: [PATCH] Time series agg improvement
Only generate tsid once per tsid hash and segment.
---
Index: server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java b/server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java
import org.apache.lucene.document.Document;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.MultiFields;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Bits;
import java.nio.file.Paths;
import shapefile
import os
import csv
import json
from datetime import datetime
weatherDataFile = '2016-sorted.csv'
def processWeatherDoc(currentStationDoc):
if 'TMAX' in currentStationDoc:
public class Abcd {
public static void main(String[] args) throws Exception {
Settings settings = Settings.builder()
.put("http.enabled", "false")
.put("transport.type", "local")
.put("discovery.type", "local")
.put("path.home", "/home/mvg/temp")
.put("cluster.name", "bwc_index_5.0.0")
.put("repositories.url.allowed_urls", "http://snapshot.test*")
package org.elasticsearch.rest.action.get;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@martijnvg
martijnvg / test.sh
Created January 26, 2014 21:43
has_parent with function_score
curl -XDELETE "http://localhost:9200/_all"
curl -XPUT "http://localhost:9200/test1" -d'
{
"mappings": {
"parent" : {
"properties": {
"weight" : {
"type": "double"
}
curl -XPUT "http://localhost:9200/index2" -d'
{
"mappings": {
"child" : {
"_parent": {
"type": "child"
}
}
}
}'
@martijnvg
martijnvg / query.sh
Created February 13, 2013 09:19
Term facet with a pattern analyzed field
curl -s -XPUT localhost:9200/_template/template_tags -d '{
"template" : "tags*",
"settings" : {
"index.analysis.analyzer.csv.type" : "pattern",
"index.analysis.analyzer.csv.pattern" : ","
},
"mappings" : {
"_default_" : {
"properties" : {
"tags" : {
{
"query": {
"bool": {
"should": [
{
"match": {
"name": "some name"
}
},
{