Skip to content

Instantly share code, notes, and snippets.

View johtani's full-sized avatar

Jun Ohtani johtani

View GitHub Profile
@johtani
johtani / line_aggregation_sample.json
Last active August 29, 2015 14:01
nested aggregation sample: tested by elasticsearch 1.1.1
DELETE /line_aggs
# create index and mapping
PUT /line_aggs
{
"settings": {
"number_of_shards": 2,
"number_of_replicas": 0
},
"mappings": {
@johtani
johtani / pref_aggregation_sample
Last active August 29, 2015 14:01
pref_aggregation_sample
# delete index
DELETE /pref_aggs
# create index
PUT /pref_aggs
{
"settings": {
"number_of_shards": 2
},
"mappings": {
@johtani
johtani / sample_mapping_data_query.json
Last active August 29, 2015 13:56
nestedなデータのハイライトの奇妙な動作と、再現データ(ES1.0、0.90.11で確認)
DELETE /bookstore
PUT /bookstore
POST /bookstore/books/_mapping
{
"books" : {
"properties": {
"book" : {
"type": "nested",
@johtani
johtani / result_of_query.json
Last active August 29, 2015 13:56
Different behavior fields in nested object. If store="yes", Elasticsearch does not return stored data. If store="no", Elasticsearch return stored data from _source.
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
public class TermFreqQuerySample {
public static void main(String... args){
Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name","test-es-cluster").build();
Client client = new TransportClient(settings)
.addTransportAddress(new InetSocketTransportAddress("192.168.30.114",9300));
QueryBuilder query = QueryBuilders.queryString("java")
.defaultField("text");
@johtani
johtani / monitoring_cluster_snippet.yml
Last active August 29, 2015 13:55
marvel separate cluster settings
######## Marvel ##########
marvel.agent.enabled: false
@johtani
johtani / wildcard_sample.txt
Last active January 2, 2016 18:49
elasticsearch-ML : "Searching indexed fields without analysing" sample
curl -XPUT "http://localhost:9200/wildcard_sample"
curl -XPOST "http://localhost:9200/wildcard_sample/users/_mapping" -d'
{
"users": {
"properties": {
"User_Name": {
"type": "multi_field",
"fields": {
"User_Name": {
@johtani
johtani / error_schema_snippet.xml
Last active January 1, 2016 11:59
synonymでエラーになるパターン
<fieldType name="text_ja_synonym" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="false">
<analyzer>
<tokenizer class="solr.JapaneseTokenizerFactory" mode="search" />
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" tokenizerFactory="solr.JapaneseTokenizerFactory"/>
</analyzer>
</fieldType>
@johtani
johtani / Solr_4_6_0_CHANGES.txt
Created November 26, 2013 04:38
Solr 4.6.0のChangesを訳してる途中。
## Versions of Major Components
* Apache Tika 1.4
* Carrot2 3.8.0
* Velocity 1.7 and Velocity Tools 2.0
* Apache UIMA 2.3.1
* Apache ZooKeeper 3.4.5
## Upgrading from Solr 4.5.0
@johtani
johtani / range_query_sample_exec.json
Created November 18, 2013 07:41
I execute "sample_exec.json" step by step. I receive response both requests: no prefix and exists prefix.
# create index
curl -XPUT "http://localhost:9200/restful"
# post mapping
curl -XPOST "http://localhost:9200/restful/events/_mapping" -d'
{
"events" : {
"dynamic_templates" : [ {
"template_string" : {
"mapping" : {