Skip to content

Instantly share code, notes, and snippets.

curl -s localhost:9200/_search -d '
{
"query" : {
"filtered" : {
"query": {
"query_string": {
"query": "search_string:a"
}
},
"filter": {
curl -XPUT localhost:9200/test/type/1 -d '{
"field1" : false
}'
curl -XPUT localhost:9200/test/type/2 -d '{
"field1" : true
}'
curl localhost:9200/test/_search -d '{
"query" : {
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.bulk.BulkRequestBuilder;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Requests;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.node.Node;
import org.elasticsearch.node.NodeBuilder;
public class Test {
static final String updateScript =
curl -XGET 'http://localhost:9200/firstindex/node/_search?pretty=true' -d ' {"query" : {
"text" : {
"label" : {
"query" : "american football",
"fuzziness" : 0.5
}
}
}
}
'
import org.elasticsearch.action.count.CountResponse;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.node.Node;
import org.elasticsearch.node.NodeBuilder;
/**
*/
public class Test {
curl -XPUT localhost:9200/test -d '
{"settings": {
"analysis" :{
"analyzer": {
"exact_analyzer": {
"type": "custom",
"tokenizer":"my_pattern_tokenizer",
"filter":[]
}
},
mackimchy:0.19.0.RC2 kimchy$ bin/plugin -install xxx/yyy/0.0.1
-> Installing xxx/yyy/0.0.1...
Trying https://github.com/downloads/xxx/yyy/yyy-0.0.1.zip...
Trying https://github.com/xxx/yyy/zipball/v0.0.1...
Failed to install xxx/yyy/0.0.1, reason: failed to download
mackimchy:0.19.0.RC2 kimchy$ bin/plugin -install xxx/yyy
-> Installing xxx/yyy...
Trying https://github.com/downloads/xxx/yyy/yyy-0.19.0.RC2.zip...
Trying https://github.com/xxx/yyy/zipball/v0.19.0.RC2...
Trying https://github.com/xxx/yyy/zipball/master...
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
public class Test {
public static void main(String[] args) {
TransportClient client = new TransportClient();
System.out.println(System.currentTimeMillis() + " BEFORE ");
client.addTransportAddress(new InetSocketTransportAddress("localhost", 9300));
System.out.println(System.currentTimeMillis() + " AFTER: " + client.connectedNodes().size());
curl -XPUT localhost:9200/test -d '{
"settings" : {
"index.number_of_shards" : 1,
"index.number_of_replicas" : 0
}
}'
curl -XPUT localhost:9200/test/type/1 -d '{
"name" : "Awesometastic 1000",
"type" : "TV Remote"