This file contains 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
/* | |
* Licensed to Elasticsearch under one or more contributor | |
* license agreements. See the NOTICE file distributed with | |
* this work for additional information regarding copyright | |
* ownership. Elasticsearch licenses this file to you under | |
* the Apache License, Version 2.0 (the "License"); you may | |
* not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 |
This file contains 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 org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; | |
import org.elasticsearch.action.index.IndexRequestBuilder; | |
import org.elasticsearch.action.index.IndexResponse; | |
import org.elasticsearch.action.search.SearchRequestBuilder; | |
import org.elasticsearch.action.search.SearchResponse; | |
import org.elasticsearch.client.Client; | |
import org.elasticsearch.client.transport.TransportClient; | |
import org.elasticsearch.common.settings.ImmutableSettings; | |
import org.elasticsearch.common.settings.Settings; | |
import org.elasticsearch.common.transport.InetSocketTransportAddress; |
This file contains 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/test | |
curl -XPUT http://localhost:9200/test/data/_mapping -d '{ | |
"data" : { | |
"dynamic_templates" : [ | |
{ | |
"string_template" : { | |
"match" : "*", | |
"match_mapping_type" : "string", | |
"mapping" : { |
This file contains 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 localhost:9200/your_index/_search -d '{ | |
"query" : { | |
"filtered" : { | |
"query" : { | |
"match_all" : {} | |
}, | |
"filter" : { | |
"missing" : { | |
"field" : "phone_numbers.id" | |
} |
This file contains 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 '{ | |
"mappings" : { | |
"demo" : { | |
"properties" : { | |
"demostring" : { | |
"type" : "string", | |
"analyzer" : "whitespace" | |
} | |
} |
This file contains 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/test/type/1 -d '{ | |
"city" : { | |
"name" : "xxx", | |
"address" : "yyy" | |
} | |
}' | |
curl localhost:9200/test/_search -d '{ | |
"query" : { | |
"query_string" : { |
This file contains 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/test/type/1 -d '{ | |
"field1" : 10, | |
"field2" : 20 | |
}' | |
curl -XPUT localhost:9200/test/type/2 -d '{ | |
"field1" : 11, | |
"field2" : 20 | |
}' |
This file contains 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 localhost:9200/test/_search -d '{ | |
"query" : { | |
"filtered" : { | |
"query" : { | |
"match_all" : {} | |
}, | |
"filter" : { | |
"terms" : { | |
"_type" : ["value1", "value2"] | |
} |
This file contains 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 com.google.common.collect.UnmodifiableIterator; | |
import org.elasticsearch.action.search.SearchResponse; | |
import org.elasticsearch.action.search.SearchType; | |
import org.elasticsearch.client.transport.TransportClient; | |
import org.elasticsearch.cluster.ClusterState; | |
import org.elasticsearch.cluster.node.DiscoveryNode; | |
import org.elasticsearch.cluster.node.DiscoveryNodes; | |
import org.elasticsearch.common.settings.ImmutableSettings; | |
import org.elasticsearch.common.transport.InetSocketTransportAddress; | |
import org.elasticsearch.common.unit.TimeValue; |
This file contains 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/test -d '{ | |
"mappings" : { | |
"type1" : { | |
"doc" : { | |
"type" : "object", | |
"enabled" : false | |
} | |
} | |
} | |
}' |
NewerOlder