|
GET / |
|
|
|
|
|
GET /_analyze |
|
{ |
|
"analyzer": "english", |
|
"text": "These are not the droids you are looking for." |
|
} |
|
|
|
|
|
GET /_analyze |
|
{ |
|
"char_filter": [ |
|
"html_strip" |
|
], |
|
"tokenizer": "standard", |
|
"filter": [ |
|
"lowercase", |
|
"stop", |
|
"snowball" |
|
], |
|
"text": "These are <em>not</em> the droids you are looking for." |
|
} |
|
|
|
|
|
GET /_analyze |
|
{ |
|
"analyzer": "german", |
|
"text": "Das sind nicht die Droiden, nach denen du suchst." |
|
} |
|
|
|
|
|
GET /_analyze |
|
{ |
|
"analyzer": "english", |
|
"text": "Das sind nicht die Droiden, nach denen du suchst." |
|
} |
|
|
|
|
|
PUT _ingest/pipeline/langdetect-pipeline |
|
{ |
|
"description": "A pipeline to detect languages", |
|
"processors": [ |
|
{ |
|
"langdetect" : { |
|
"field" : "quote", |
|
"target_field" : "language" |
|
} |
|
} |
|
] |
|
} |
|
|
|
|
|
POST _ingest/pipeline/langdetect-pipeline/_simulate |
|
{ |
|
"docs": [ |
|
{ |
|
"_source": { |
|
"quote": "Das sind nicht die Droiden, nach denen du suchst." |
|
} |
|
} |
|
] |
|
} |
|
|
|
|
|
GET /_analyze |
|
{ |
|
"tokenizer": "standard", |
|
"filter": [ |
|
{ |
|
"type": "phonetic", |
|
"encoder": "beider_morse", |
|
"languageset": "any" |
|
} |
|
], |
|
"text": "These are not the droids you are looking for." |
|
} |
|
|
|
|
|
GET /_analyze |
|
{ |
|
"char_filter": [ |
|
"html_strip" |
|
], |
|
"tokenizer": "standard", |
|
"filter": [ |
|
"lowercase", |
|
"stop", |
|
"snowball" |
|
], |
|
"text": "Obi-Wan never told you what happened to your father." |
|
} |
|
|
|
|
|
GET /_analyze |
|
{ |
|
"char_filter": [ |
|
"html_strip" |
|
], |
|
"tokenizer": "standard", |
|
"filter": [ |
|
"lowercase", |
|
"stop", |
|
"snowball" |
|
], |
|
"text": "<b>No</b>. I am your father." |
|
} |
|
|
|
|
|
PUT /starwars |
|
{ |
|
"settings": { |
|
"number_of_shards": 1, |
|
"analysis": { |
|
"filter": { |
|
"my_synonym_filter": { |
|
"type": "synonym", |
|
"synonyms": [ |
|
"father,dad", |
|
"droid => droid,machine" |
|
] |
|
} |
|
}, |
|
"analyzer": { |
|
"my_analyzer": { |
|
"char_filter": [ |
|
"html_strip" |
|
], |
|
"tokenizer": "standard", |
|
"filter": [ |
|
"lowercase", |
|
"stop", |
|
"snowball", |
|
"my_synonym_filter" |
|
] |
|
} |
|
} |
|
} |
|
}, |
|
"mappings": { |
|
"_doc": { |
|
"properties": { |
|
"quote": { |
|
"type": "text", |
|
"analyzer": "my_analyzer" |
|
} |
|
} |
|
} |
|
} |
|
} |
|
GET /starwars/_mapping |
|
GET /starwars/_settings |
|
PUT /starwars/_doc/1 |
|
{ |
|
"quote": "These are <em>not</em> the droids you are looking for." |
|
} |
|
PUT /starwars/_doc/2 |
|
{ |
|
"quote": "Obi-Wan never told you what happened to your father." |
|
} |
|
PUT /starwars/_doc/3 |
|
{ |
|
"quote": "<b>No</b>. I am your father." |
|
} |
|
GET /starwars/_doc/1 |
|
GET /starwars/_doc/1/_source |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"match_all": { } |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote": "droid" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote": "dad" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_doc/0/_explain |
|
{ |
|
"query": { |
|
"match": { |
|
"quote": "father" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote": "machine" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"match_phrase": { |
|
"quote": "I am your father" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"match_phrase": { |
|
"quote": { |
|
"query": "I am not your father", |
|
"slop": 1 |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote": { |
|
"query": "van", |
|
"fuzziness": "AUTO" |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote": { |
|
"query": "ovi-van", |
|
"fuzziness": 1 |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search?explain=true |
|
{ |
|
"query": { |
|
"match": { |
|
"quote": "father" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"function_score": { |
|
"query": { |
|
"match": { |
|
"quote": "father" |
|
} |
|
}, |
|
"random_score": {} |
|
} |
|
} |
|
} |
|
|
|
|
|
GET /starwars/_analyze |
|
{ |
|
"analyzer" : "my_analyzer", |
|
"text": "These are my father's machines." |
|
} |
|
|
|
|
|
PUT /starwars/_doc/4 |
|
{ |
|
"quote": "These are my father's machines." |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote": "my father machine" |
|
} |
|
} |
|
} |
|
|
|
|
|
DELETE /starwars/_doc/4 |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote": "my father machine" |
|
} |
|
} |
|
} |
|
|
|
|
|
PUT /starwars/_doc/4 |
|
{ |
|
"quote": "These droids are my father's father's machines." |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote": "my father machine" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote": "father" |
|
} |
|
}, |
|
"highlight": { |
|
"type": "unified", |
|
"pre_tags": [ |
|
"<tag>" |
|
], |
|
"post_tags": [ |
|
"</tag>" |
|
], |
|
"fields": { |
|
"quote": {} |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"bool": { |
|
"must": { |
|
"match": { |
|
"quote": "father" |
|
} |
|
}, |
|
"should": [ |
|
{ |
|
"match": { |
|
"quote": "your" |
|
} |
|
}, |
|
{ |
|
"match": { |
|
"quote": "obi" |
|
} |
|
} |
|
] |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"bool": { |
|
"filter": { |
|
"match": { |
|
"quote": "father" |
|
} |
|
}, |
|
"should": [ |
|
{ |
|
"match": { |
|
"quote": "your" |
|
} |
|
}, |
|
{ |
|
"match": { |
|
"quote": "obi" |
|
} |
|
} |
|
] |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"bool": { |
|
"must": { |
|
"match": { |
|
"quote": "father" |
|
} |
|
}, |
|
"should": [ |
|
{ |
|
"match": { |
|
"quote": { |
|
"query": "your", |
|
"_name": "quote-your" |
|
} |
|
} |
|
}, |
|
{ |
|
"match": { |
|
"quote": { |
|
"query": "obi", |
|
"_name": "quote-obi" |
|
} |
|
} |
|
}, |
|
{ |
|
"match": { |
|
"quote": { |
|
"query": "droid", |
|
"_name": "quote-droid" |
|
} |
|
} |
|
} |
|
], |
|
"minimum_should_match": 2 |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"bool": { |
|
"must": { |
|
"match": { |
|
"quote": "father" |
|
} |
|
}, |
|
"should": [ |
|
{ |
|
"match": { |
|
"quote": "your" |
|
} |
|
}, |
|
{ |
|
"match": { |
|
"quote": { |
|
"query": "obi", |
|
"boost": 3 |
|
} |
|
} |
|
} |
|
] |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"bool": { |
|
"must": { |
|
"match": { |
|
"quote": "father father" |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"bool": { |
|
"must": { |
|
"match": { |
|
"quote": "father" |
|
} |
|
}, |
|
"should": { |
|
"match_phrase": { |
|
"quote": "father father" |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote": "drui" |
|
} |
|
}, |
|
"suggest": { |
|
"my_suggestion" : { |
|
"text" : "drui", |
|
"term" : { |
|
"field" : "quote" |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
GET /_analyze |
|
{ |
|
"char_filter": [ |
|
"html_strip" |
|
], |
|
"tokenizer": { |
|
"type": "ngram", |
|
"min_gram": "3", |
|
"max_gram": "3", |
|
"token_chars": [ |
|
"letter" |
|
] |
|
}, |
|
"filter": [ |
|
"lowercase" |
|
], |
|
"text": "These are <em>not</em> the droids you are looking for." |
|
} |
|
|
|
|
|
GET /_analyze |
|
{ |
|
"char_filter": [ |
|
"html_strip" |
|
], |
|
"tokenizer": { |
|
"type": "edge_ngram", |
|
"min_gram": "1", |
|
"max_gram": "3", |
|
"token_chars": [ |
|
"letter" |
|
] |
|
}, |
|
"filter": [ |
|
"lowercase" |
|
], |
|
"text": "These are <em>not</em> the droids you are looking for." |
|
} |
|
|
|
|
|
PUT /starwars_v42 |
|
{ |
|
"settings": { |
|
"number_of_shards": 1, |
|
"index": { |
|
"similarity": { |
|
"default": { |
|
"type": "BM25", |
|
"b": 0, |
|
"k1": 0 |
|
} |
|
} |
|
}, |
|
"analysis": { |
|
"filter": { |
|
"my_synonym_filter": { |
|
"type": "synonym", |
|
"synonyms": [ |
|
"father,dad", |
|
"droid => droid,machine" |
|
] |
|
}, |
|
"my_ngram_filter": { |
|
"type": "ngram", |
|
"min_gram": "3", |
|
"max_gram": "3", |
|
"token_chars": [ |
|
"letter" |
|
] |
|
} |
|
}, |
|
"analyzer": { |
|
"my_lowercase_analyzer": { |
|
"char_filter": [ |
|
"html_strip" |
|
], |
|
"tokenizer": "whitespace", |
|
"filter": [ |
|
"lowercase" |
|
] |
|
}, |
|
"my_full_analyzer": { |
|
"char_filter": [ |
|
"html_strip" |
|
], |
|
"tokenizer": "standard", |
|
"filter": [ |
|
"lowercase", |
|
"stop", |
|
"snowball", |
|
"my_synonym_filter" |
|
] |
|
}, |
|
"my_ngram_analyzer": { |
|
"char_filter": [ |
|
"html_strip" |
|
], |
|
"tokenizer": "whitespace", |
|
"filter": [ |
|
"lowercase", |
|
"stop", |
|
"my_ngram_filter" |
|
] |
|
} |
|
} |
|
} |
|
}, |
|
"mappings": { |
|
"_doc": { |
|
"properties": { |
|
"quote": { |
|
"type": "text", |
|
"fields": { |
|
"lowercase": { |
|
"type": "text", |
|
"analyzer": "my_lowercase_analyzer" |
|
}, |
|
"full": { |
|
"type": "text", |
|
"analyzer": "my_full_analyzer" |
|
}, |
|
"ngram": { |
|
"type": "text", |
|
"analyzer": "my_ngram_analyzer" |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /_reindex |
|
{ |
|
"source": { |
|
"index": "starwars" |
|
}, |
|
"dest": { |
|
"index": "starwars_v42" |
|
} |
|
} |
|
|
|
|
|
PUT _alias |
|
{ |
|
"actions": [ |
|
{ |
|
"add": { |
|
"index": "starwars_v42", |
|
"alias": "starwars_extended" |
|
} |
|
} |
|
] |
|
} |
|
|
|
|
|
POST /starwars/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote": "droid" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars_extended/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote.full": "droid" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars_extended/_search?explain=true |
|
{ |
|
"query": { |
|
"multi_match": { |
|
"query": "obiwan", |
|
"fields": [ |
|
"quote", |
|
"quote.lowercase", |
|
"quote.full", |
|
"quote.ngram" |
|
], |
|
"type": "most_fields" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars_extended/_search |
|
{ |
|
"query": { |
|
"multi_match": { |
|
"query": "you", |
|
"fields": [ |
|
"quote", |
|
"quote.lowercase^5", |
|
"quote.full", |
|
"quote.ngram" |
|
], |
|
"type": "best_fields" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars_extended/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote.ngram": { |
|
"query": "the", |
|
"analyzer": "standard" |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars_extended/_close |
|
PUT /starwars_extended/_settings |
|
{ |
|
"index": { |
|
"similarity": { |
|
"default": { |
|
"type": "BM25", |
|
"b": null, |
|
"k1": null |
|
} |
|
} |
|
}, |
|
"analysis": { |
|
"filter": { |
|
"my_edgegram_filter": { |
|
"type": "edge_ngram", |
|
"min_gram": 3, |
|
"max_gram": 10 |
|
}, |
|
"my_shingle_filter": { |
|
"type": "shingle", |
|
"min_shingle_size": 2, |
|
"max_shingle_size": 2 |
|
} |
|
}, |
|
"analyzer": { |
|
"my_edgegram_analyzer": { |
|
"char_filter": [ |
|
"html_strip" |
|
], |
|
"tokenizer": "standard", |
|
"filter": [ |
|
"lowercase", |
|
"my_edgegram_filter" |
|
] |
|
}, |
|
"my_shingle_analyzer": { |
|
"type": "custom", |
|
"tokenizer": "standard", |
|
"filter": [ |
|
"lowercase", |
|
"my_shingle_filter" |
|
] |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars_extended/_open |
|
|
|
|
|
GET starwars_extended/_analyze |
|
{ |
|
"text": "Father", |
|
"analyzer": "my_edgegram_analyzer" |
|
} |
|
|
|
|
|
PUT /starwars_extended/_doc/_mapping |
|
{ |
|
"properties": { |
|
"quote": { |
|
"type": "text", |
|
"fields": { |
|
"edgegram": { |
|
"type": "text", |
|
"analyzer": "my_edgegram_analyzer", |
|
"search_analyzer": "standard" |
|
}, |
|
"shingle": { |
|
"type": "text", |
|
"analyzer": "my_shingle_analyzer" |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
PUT /starwars_extended/_doc/5 |
|
{ |
|
"quote": "I find your lack of faith disturbing." |
|
} |
|
PUT /starwars_extended/_doc/6 |
|
{ |
|
"quote": "That... is your failure." |
|
} |
|
|
|
|
|
GET /starwars_extended/_doc/5/_termvectors |
|
{ |
|
"fields": [ |
|
"quote.edgegram" |
|
], |
|
"offsets": true, |
|
"payloads": true, |
|
"positions": true, |
|
"term_statistics": true, |
|
"field_statistics": true |
|
} |
|
|
|
|
|
POST /starwars_extended/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote": "fail" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars_extended/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote.lowercase": "fail" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars_extended/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote.full": "fail" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars_extended/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote.ngram": "fail" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars_extended/_search |
|
{ |
|
"query": { |
|
"match": { |
|
"quote.edgegram": "fail" |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars_extended/_update_by_query |
|
{ |
|
"query": { |
|
"bool": { |
|
"must_not": { |
|
"exists": { |
|
"field": "quote.edgegram" |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars_extended/_search |
|
{ |
|
"query": { |
|
"bool": { |
|
"must": { |
|
"match": { |
|
"quote.lowercase": "these droids are" |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
POST /starwars_extended/_search |
|
{ |
|
"query": { |
|
"bool": { |
|
"must": { |
|
"match": { |
|
"quote.shingle": "these droids are" |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
PUT /decompound_en |
|
{ |
|
"settings": { |
|
"number_of_shards": 1, |
|
"analysis": { |
|
"filter": { |
|
"british_decompounder": { |
|
"type": "hyphenation_decompounder", |
|
"hyphenation_patterns_path": "hyph/en_GB.xml", |
|
"word_list": [ |
|
"death", |
|
"star" |
|
] |
|
} |
|
}, |
|
"analyzer": { |
|
"british_decompound": { |
|
"type": "custom", |
|
"tokenizer": "standard", |
|
"filter": [ |
|
"lowercase", |
|
"british_decompounder" |
|
] |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
GET /decompound_en/_analyze |
|
{ |
|
"analyzer" : "british_decompound", |
|
"text" : "deathstar" |
|
} |
|
|
|
|
|
DELETE /decompound_en |
|
|
|
|
|
PUT /decompound_de |
|
{ |
|
"settings": { |
|
"number_of_shards": 1, |
|
"analysis": { |
|
"filter": { |
|
"german_decompounder": { |
|
"type": "hyphenation_decompounder", |
|
"word_list_path": "dictionary-de.txt", |
|
"hyphenation_patterns_path": "hyph/de_DR.xml", |
|
"only_longest_match": true, |
|
"min_subword_size": 4 |
|
}, |
|
"german_stemmer": { |
|
"type": "stemmer", |
|
"language": "light_german" |
|
} |
|
}, |
|
"analyzer": { |
|
"german_decompound": { |
|
"type": "custom", |
|
"tokenizer": "standard", |
|
"filter": [ |
|
"lowercase", |
|
"german_decompounder", |
|
"german_normalization", |
|
"german_stemmer" |
|
] |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
GET /decompound_de/_analyze |
|
{ |
|
"analyzer" : "german_decompound", |
|
"text" : "Todesstern" |
|
} |
|
|
|
|
|
DELETE /decompound_de |
|
|
|
|
|
PUT _alias |
|
{ |
|
"actions": [ |
|
{ |
|
"remove": { |
|
"index": "starwars_v42", |
|
"alias": "starwars_extended" |
|
} |
|
} |
|
] |
|
} |
|
DELETE /starwars |
|
DELETE /starwars_v42 |