Skip to content

Instantly share code, notes, and snippets.

View jpountz's full-sized avatar

Adrien Grand jpountz

  • Elasticsearch
  • Caen, France
View GitHub Profile
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@jpountz
jpountz / test.sh
Last active August 29, 2015 14:02
UTF8 / elasticsearch
$ echo $LANG
en_US.UTF-8
$ curl -XPUT 'localhost:9200/test/utf8/1' -d '{ "field": "éèçù" }'
{"_index":"test","_type":"utf8","_id":"1","_version":2,"created":false}
$ curl -XGET 'localhost:9200/test/utf8/1'
{"_index":"test","_type":"utf8","_id":"1","_version":2,"found":true,"_source":{ "field": "éèçù" }}
curl -XGET "http://localhost:9200/installs/install/_search?search_type=count&pretty=1" -d'
{
"aggs": {
"last_day" : {
"filter" : {
"range" : {
"_timestamp" : {
"gt" : "now-1d"
}
}
DELETE /test
PUT /test
{
"mappings": {
"person": {
"properties": {
"name": { "type": "string" },
"attributes": {
"type": "nested",
@jpountz
jpountz / ram_usage.patch
Created December 23, 2013 16:22
Patch that gives more detailed ram usage.
Index: lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsReader.java
===================================================================
--- lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsReader.java (revision 1553093)
+++ lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsReader.java (working copy)
@@ -18,8 +18,10 @@
*/
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Collections;
@jpountz
jpountz / fielddata.json
Created December 16, 2013 15:05
Disable field data
{
"type": "string",
"fielddata": {
"format": "disabled"
}
}
@jpountz
jpountz / aggs_filter.json
Created December 16, 2013 12:16
aggs_filter.json
curl -XGET "http://localhost:9200/movies/_search" -d'
{
"query": {
"nested": {
"path": "credits",
"query": {
"match": {
"credits.person_id": 1
}
}
@jpountz
jpountz / highlighting_of_stopwords.sh
Created December 16, 2013 10:24
Highlighting of stop words
curl -XDELETE 'localhost:9200/test?pretty'
echo
curl -XPUT 'localhost:9200/test?pretty' -d '
{
"settings" : {
"index" : {
"analysis" : {
"analyzer" : {
"default" : {
/*
* Licensed to ElasticSearch and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. ElasticSearch licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
curl -XDELETE localhost:9200/test?pretty
echo
curl -XPUT localhost:9200/test?pretty -d '{
"settings": {
"analysis" : {
"analyzer" : {
"str_search_analyzer" : {
"tokenizer" : "whitespace",
"filter" : ["lowercase"]