This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Aqui estou postando o mapping para todos os tipo do índice twitter | |
$ curl -XPUT 'http://localhost:1980/twitter/_mapping' -d ' | |
{ | |
"tweet" : { | |
"properties" : { | |
"message" : {"type" : "string", "store" : "yes"} | |
} | |
} | |
} | |
' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT indice_teste | |
{ | |
"settings": { | |
"analysis": { | |
"analyzer": { | |
"pt_analyzer": { | |
"type": "custom", | |
"filter": [ | |
"stop_noise", | |
"lowercase" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Query inicial | |
------------------------- | |
POST _search | |
{ | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"term": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" : { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from elasticsearch import Elasticsearch | |
es = Elasticsearch(hosts=[{"host": "localhost", "port": 9200}]) | |
print es.search(body={ | |
"query": { | |
"function_score": { | |
"query": { | |
"match_all": {} | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create an index called "services" with suggest_field mapped as "completion" with payloads | |
POST services | |
{ | |
"mappings": { | |
"service": { | |
"properties": { | |
"name": { | |
"type": "string" | |
}, | |
"suggest_field": { |
OlderNewer