Skip to content

Instantly share code, notes, and snippets.

View clement-tourriere's full-sized avatar

Clément Tourrière clement-tourriere

View GitHub Profile
@clement-tourriere
clement-tourriere / gist:8d06a0985f859666ae53
Created August 31, 2015 08:15
Reproduce RemoteTransportException with geo_point
DELETE test_point
PUT test_point
{
"mappings": {
"point": {
"properties": {
"point": {
"type": "geo_point"
}
@clement-tourriere
clement-tourriere / ExternalMapper.java
Created August 28, 2015 15:44
Simple external geo_point plugin
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.*;
@clement-tourriere
clement-tourriere / celery.py
Created August 28, 2015 15:41
Geo Indexing tests
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
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 August 28, 2015 15:25
Add geo_point type in input.java and output.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 August 29, 2015 14:14
Polygon containing a coordinate with more than two elements
# 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 September 3, 2014 09:41
Testing ElasticSearch geo_polygon filter
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": {