Skip to content

Instantly share code, notes, and snippets.

Avatar

Clément Tourrière clement-tourriere

View GitHub Profile
@clement-tourriere
clement-tourriere / gist:8d06a0985f859666ae53
Created Aug 31, 2015
Reproduce RemoteTransportException with geo_point
View gist:8d06a0985f859666ae53
DELETE test_point
PUT test_point
{
"mappings": {
"point": {
"properties": {
"point": {
"type": "geo_point"
}
@clement-tourriere
clement-tourriere / ExternalMapper.java
Created Aug 28, 2015
Simple external geo_point plugin
View ExternalMapper.java
package com.opendatasoft.elasticsearch.index.mapper.geo;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.geo.GeoPoint;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.fielddata.FieldDataType;
import org.elasticsearch.index.mapper.*;
View celery.py
from __future__ import absolute_import
from celery import Celery
# This file must be put in a subdirectory proj
app = Celery('tasks', broker='redis://localhost', backend='redis://localhost', include=['proj.tasks'])
app.conf.update(
CELERY_TASK_SERIALIZER='json',
CELERY_ACCEPT_CONTENT=['json'], # Ignore other content
View gist:855a24f150efb06e8fec
org.elasticsearch.script.groovy.GroovyScriptExecutionException: BufferOverflowException[null]
at org.elasticsearch.script.groovy.GroovyScriptEngineService$GroovyScript.run(GroovyScriptEngineService.java:278)
at org.elasticsearch.search.fetch.script.ScriptFieldsFetchSubPhase.hitExecute(ScriptFieldsFetchSubPhase.java:74)
at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:194)
at org.elasticsearch.search.SearchService.executeScan(SearchService.java:276)
at org.elasticsearch.search.action.SearchServiceTransportAction$21.call(SearchServiceTransportAction.java:520)
at org.elasticsearch.search.action.SearchServiceTransportAction$21.call(SearchServiceTransportAction.java:517)
at org.elasticsearch.search.action.SearchServiceTransportAction$23.run(SearchServiceTransportAction.java:559)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
@clement-tourriere
clement-tourriere / StreamInput.java
Created Aug 28, 2015
Add geo_point type in input.java and output.java
View StreamInput.java
@SuppressWarnings({"unchecked"})
@Nullable
public Object readGenericValue() throws IOException {
byte type = readByte();
switch (type) {
case -1:
return null;
case 0:
return readString();
case 1:
@clement-tourriere
clement-tourriere / gist:aa2abdc94de7d1456c58
Last active Aug 29, 2015
Polygon containing a coordinate with more than two elements
View gist:aa2abdc94de7d1456c58
# Delete index
curl -XDELETE "http://localhost:9200/test_geojson"
# Create a test index
curl -XPOST "http://localhost:9200/test_geojson"
# Put mapping
curl -XPOST "http://localhost:9200/test_geojson/geo/_mapping" -d'
{
"geo": {
@clement-tourriere
clement-tourriere / gist:a05723be373d75dddf72
Created Sep 3, 2014
Testing ElasticSearch geo_polygon filter
View gist:a05723be373d75dddf72
curl -XDELETE "http://localhost:9200/geo_polygon"
curl -XPOST "http://localhost:9200/geo_polygon"
# We index points with geo_point and geo_shape types for testing purpose
curl -XPOST "http://localhost:9200/geo_polygon/loc/_mapping" -d'
{
"loc": {
"properties": {