Skip to content

Instantly share code, notes, and snippets.

index:
number_of_shards: 2
number_of_replicas: 2
curl -XPOST localhost:9200/test/person -d '{ "test" : true }'
curl -XGET localhost:9200/_search -d '{ "query": { "field": { "test" : true } } }'
final List<String> stopWords = Arrays.asList(
"a", "an", "and", "are", "as", "at", "be", "but", "by",
"for", "if", "in", "into", "is", "it",
"no", "not", "of", "on", "or", "such",
"that", "the", "their", "then", "there", "these",
"they", "this", "to", "was", "will", "with"
);
public class TestMe {
public static void main(String[] args) throws Exception {
NodeBuilder nb = NodeBuilder.nodeBuilder().client(true);
Node node = nb.node();
Client client = node.client();
XContentBuilder content = XContentFactory.smileBuilder().startObject();
content.field("indexid", "index21");
time curl -XPOST localhost:9200/test/type1 -d '
{
"test" : "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do e
index:
analysis:
analyzer:
hebrew:
type: com.mycompany.HebrewAnalyzerProvider
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
curl -XGET 'http://localhost:9200/rs1050/jobs/_search' -d '
{
"query" : {
"filtered" : {
"query" : {
"query_string" : {
"query" : "some query string here"
}
},
"filter" : {
curl -XPUT localhost:9200/test/type1/1 -d '{
"value" : 1
}'
curl -XPUT localhost:9200/test/type1/2 -d '{
"value" : 2
}'
curl -XPUT localhost:9200/test/type1/3 -d '{
"value" : 3
curl -XPUT localhost:9200/test
curl -XPUT localhost:9200/test/type1/_mapping -d '{
"type1" : {
"properties" : {
"path" : {
"type" : "string",
"index" : "not_analyzed"
}
}