Skip to content

Instantly share code, notes, and snippets.

Avatar
😁

Luiz Guilherme Pais dos Santos luizgpsantos

😁
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am luizgpsantos on github.
  • I am luizgpsantos (https://keybase.io/luizgpsantos) on keybase.
  • I have a public key ASCJGrdw4Sbh_e26BeRBFybp61FJH-om-0Ppx98OfexaGAo

To claim this, I am signing this object:

View ElasticsearchExample.java
package test;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
View SimpleOperationsElasticsearchRestClient.java
package test;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.entity.ContentType;
import org.apache.http.nio.entity.NStringEntity;
View crud.sh
echo "Delete document"
curl -XDELETE 'http://localhost:8888/'
echo ""
echo "\nInitial search"
curl -XGET 'http://localhost:8888/'
echo ""
echo "\nCreate document"
curl -XPUT 'http://localhost:8888/'
View indexar_documentos.sh
curl -XPOST "http://localhost:9200/index_name" -d'
{
"mappings": {
"your_type": {
"properties": {
"colours": {
"type": "string",
"index": "not_analyzed"
}
}
@luizgpsantos
luizgpsantos / new relic logs
Created Jan 7, 2015
Elasticsearch nre relic plugin logs
View new relic 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
View 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": {
View gist:125656e2132097184a72
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 {
View gist:a1ca8b87b70ae4c2cf5c
from elasticsearch import Elasticsearch
es = Elasticsearch(hosts=[{"host": "localhost", "port": 9200}])
print es.search(body={
"query": {
"function_score": {
"query": {
"match_all": {}
},
@luizgpsantos
luizgpsantos / Exemplo completo
Last active Feb 16, 2021
Analyzer para plural e acentos no elasticsearch
View Exemplo completo
// Ao [criar o índice][0], especifique um [analyzer customizado][1] responsável por tratar palavras
// com caracteres especiais e o plural da lingua Portuguesa. Algumas palavras precisarão de uma
// sintonia fina, o que pode ser feito através de [stemmer overrides][2]. Além disso, ao criar um
// campo atribua o analyzer a ele.
PUT produtos
{
"settings": {
"analysis": {
"analyzer": {