Lucene 工做原理數據庫
ElasticSearch 中的基本概念json
ElasticSearch API 命名風格app
關係型數據庫和ElasticSearch 操做姿式對比less
ElasticSearch 基本操做3d
{ "settings":{ "number_of_shards":3, "number_of_replicas":1 }, "mappings":{ "man":{ "properties":{ "name":{ "type":"text" }, "conutry":{ "type":"keyword" }, "age":{ "type":"integer" }, "date":{ "type":"date", "format":"yyyy-MM-dd HH:mm:ss ||yyyy-MM-dd||epoch_millis" } } }, "woman":{} } }
{ "name":"Tom", "country":"China", "age":18, "date":"2000-10-11" }
{ "name":"Tom老師", "country":"China", "age":88, "date":"2000-10-11" }
{ "script":{ "lang":"painless", "inline":"ctx._source.age += 1", } }
{ "script":{ "lang":"painless", "inline":"ctx._source.age = params.age", "params":{ "age":30 } } }
{ "query":{ "match":{ "name":"老師" } }, "sort":[ {"age":{"order":"desc"}} ] }
{ "aggs":{ "grades_age":{ "stats":{ "field":"age" } } } }
解決聚合分組沒效果::code
ElasticSearch 高級查詢orm
{ "query":{ "match":{ "name":"Tom小" } } }
{ "query":{ "match_phrase":{ "name":"小小" } } }
{ "query":{ "multi_match":{ "query":"Tom", "fields":["name","country"] } } }
{ "query":{ "query_string":{ "query":"(小 AND USA) OR china", "fields":["name","country"] } } }
{ "query":{ "range":{ "age":{ "gt":87, "lte":90 } } } }
{ "query":{ "range":{ "date":{ "gt":"2000-10-12", "lte":"now" } } } }
{ "query":{ "bool":{ "filter":{ "term":{ "age":98 } } } } }
{ "query":{ "bool":{ "must":[ { "match":{ "name":"老師" } }, { "match":{ "country":"China" } } ], "filter":{ "term":{ "age":88 } } } } }