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 / 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"
}
},
{
curl -s -XDELETE 'http://localhost:9200/test-idx'
echo
curl -s -XPUT 'http://localhost:9200/test-idx' -d '{
"settings": {
"index.number_of_shards" : 1
},
"mappings" : {
"document" : {
"properties" : {
"tags" : {