Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View luizgpsantos's full-sized avatar
😁

Luiz Guilherme Pais dos Santos luizgpsantos

😁
View GitHub Profile
http://localhost:9200/_view/index_test/type_test/1
{
"error": "RemoteTransportException[[localhost][inet[/10.11.32.11:9300]][view/s]]; nested: NullPointerException; ",
"status": 500
}
[2014-02-13 17:27:19,402][DEBUG][action.view ] [localhost] [index_test][0]: failed to execute [org.elasticsearch.action.view.ViewRequest@401b8cc4]
org.elasticsearch.transport.RemoteTransportException: [localhost][inet[/10.11.32.11:9300]][view/s]
Caused by: java.lang.NullPointerException
@luizgpsantos
luizgpsantos / gist:9216108
Last active August 29, 2015 13:56
Compute TF/IDF across indexes
curl -XPUT localhost:9200/index1/type/1 -d '{
"title": "alice dance"
}'
curl -XPUT localhost:9200/index1/type/2 -d '{
"title": "alice jump"
}'
curl -XPUT localhost:9200/index1/type/3 -d '{
"title": "alice run"
@luizgpsantos
luizgpsantos / gist:b751724fc6267a9ae2d8
Created July 25, 2014 02:17
Contador de palavras
PUT indice_teste
{
"settings": {
"analysis": {
"analyzer": {
"pt_analyzer": {
"type": "custom",
"filter": [
"stop_noise",
"lowercase"
@luizgpsantos
luizgpsantos / gist:a8ea5743cfe96aea478d
Last active August 29, 2015 14:05
Otimização de filtros
Query inicial
-------------------------
POST _search
{
"query": {
"bool": {
"must": [
{
"term": {
@luizgpsantos
luizgpsantos / gist:031fb36af5545afde29b
Created September 1, 2014 20:16
Update nested document
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test -d '{
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0
},
"mappings": {
"car": {
"properties": {
"creators" : {
@luizgpsantos
luizgpsantos / gist:a1ca8b87b70ae4c2cf5c
Created September 12, 2014 13:53
Simulate timeout
from elasticsearch import Elasticsearch
es = Elasticsearch(hosts=[{"host": "localhost", "port": 9200}])
print es.search(body={
"query": {
"function_score": {
"query": {
"match_all": {}
},
@luizgpsantos
luizgpsantos / gist:125656e2132097184a72
Created September 15, 2014 13:04
listar indices java api
import java.io.IOException;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
public class Teste {
@luizgpsantos
luizgpsantos / context_suggester
Last active August 29, 2015 14:11
context suggester
# create an index called "services" with suggest_field mapped as "completion" with payloads
POST services
{
"mappings": {
"service": {
"properties": {
"name": {
"type": "string"
},
"suggest_field": {
@luizgpsantos
luizgpsantos / new relic logs
Created January 7, 2015 16:36
Elasticsearch nre relic plugin logs
[2015-01-07 14:34:46,411][TRACE][org.elasticsearch.service.newrelic.NewRelicReporter] * elasticsearch.dev.node.filtercache.memorySizeInBytes: 0.0
[2015-01-07 14:34:46,412][TRACE][org.elasticsearch.service.newrelic.NewRelicReporter] * elasticsearch.dev.node.filtercache.evictions: 0.0
[2015-01-07 14:34:46,412][TRACE][org.elasticsearch.service.newrelic.NewRelicReporter] * elasticsearch.dev.node.idcache.memorySizeInBytes: 0.0
[2015-01-07 14:34:46,412][TRACE][org.elasticsearch.service.newrelic.NewRelicReporter] * elasticsearch.dev.node.docs.count: 1.0
[2015-01-07 14:34:46,412][TRACE][org.elasticsearch.service.newrelic.NewRelicReporter] * elasticsearch.dev.node.docs.deleted: 0.0
[2015-01-07 14:34:46,413][TRACE][org.elasticsearch.service.newrelic.NewRelicReporter] * elasticsearch.dev.node.flush.total: 0.0
[2015-01-07 14:34:46,413][TRACE][org.elasticsearch.service.newrelic.NewRelicReporter] * elasticsearch.dev.node.flush.totalTimeInMillis: 0.0
[2015-01-07 14:34:46,413][TRACE][org.elasticsearch.service.newrelic
curl -XPOST "http://localhost:9200/index_name" -d'
{
"mappings": {
"your_type": {
"properties": {
"colours": {
"type": "string",
"index": "not_analyzed"
}
}