The index

Introduction to Common Indexes

1.1. BitMap Index




1.2. Hash index

1.3. BTREE index





1.4. Inverted index (inverted index)












1.4.1. Word dictionary query optimization













ElasticSearch

  • ES version in use: 5.6
  • Website address: https://www.elastic.co/products/elasticsearch
  • The Heart of The Elastic Stack
  • Some key information about ES:
  •  was first published in February 2010
  •  Elasticsearch Store, Search, and Analyze
  •  Rich Restful interfaces

The basic concept

Type (type)

Instance to explain

<p style="line-height: 2em;" ><span style="font-size: 14px;" >curl -X PUT http://ip:9200/loan_idx -H 'content-type: application/json' <br> -d '{"mappings":{ "order_info":{ "dynamic_date_formats":["yyyy-MM-dd HH:mm:ss||yyyy-MM-dd],<br> "dynamic_templates":[<br> {"orderId2":{<br> "match_mapping_type":"string",<br> "match_pattern":"regex",<br> "match":"^orderId$",<br> "mapping":{<br> "type":"long"<br> }<br> }<br> },<br> {"strings_as_keywords":{<br> "match_mapping_type":"string",<br> "mapping":{<br> "type":"keyword",<br> "norms":false<br> }<br> }<br> }<br> ]<br> }<br>},<br>"aliases":{<br> "loan_alias":{}<br>}}'<br></span></p>Copy the code

<p style="line-height: 2em;" ><span style="font-size: 14px;" >"aliases":{ "loan_alias":{ }<br> }<br></span></p>Copy the code


<p style="line-height: 2em;" ><span style="font-size: 14px;" >POST loan_idx/_update_by_query<br> { "script":{ "source":"long getDayDiff(def dateStr1, def dateStr2){ <br> LocalDateTime date1= toLocalDate(dateStr1); LocalDateTime date2= toLocalDate(dateStr2); ChronoUnit.DAYS.between(date1, date2); <br> }<br> LocalDateTime toLocalDate(def dateStr)<br> { <br> DateTimeFormatter formatter = DateTimeFormatter.ofPattern(\"yyyy-MM-dd HH:mm:ss\"); LocalDateTime.parse(dateStr, formatter); <br> }<br> if(getDayDiff(ctx._source.appSubmissionTime, ctx._source.lenssonStartDate) < 2)<br> { <br> ctx._source.expectLoanDate=ctx._source.appSubmissionTime<br> }", "lang":"painless"<br> }<br> , "query":<br> { "bool":{ "filter":[<br> { "bool":{ "must":[<br> { "range":{ <br> "appSubmissionTime":<br> {<br> "from":"2018-09-10 00:00:00", "to":"2018-09-10 23:59:59", "include_lower":true, "include_upper":true<br> }<br> }<br> }<br> ]<br> }<br> }<br> ]<br> }<br> }<br>}<br></span></p>Copy the code


<p style="line-height: 2em;" ><span style="font-size: 14px;" >long getDayDiff(def dateStr1, def dateStr2){<br> LocalDateTime date1= toLocalDate(dateStr1); <br> LocalDateTime date2= toLocalDate(dateStr2); <br> ChronoUnit.DAYS.between(date1, date2); <br>}<br>LocalDateTime toLocalDate(def dateStr){<br> DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); <br> LocalDateTime.parse(dateStr, formatter); <br>}if(getDayDiff(ctx._source.appSubmissionTime, ctx._source.lenssonStartDate) < 2){<br> ctx._source.expectLoanDate=ctx._source.appSubmissionTime<br>}<br></span></p>Copy the code


<p style="line-height: 2em;" ><span style="font-size: 14px;" >{ "user":[<br> { "first":"John", "last":"Smith"<br> },<br> { "first":"Alice", "last":"White"<br> }<br> ]<br>}<br></span></p>Copy the code


<p style="line-height: 2em;" ><span style="font-size: 14px;" >{ "user.first":[ "John", "Alice"<br> ], "user.last":[ "Smith", "White"<br> ]<br>}<br></span></p>Copy the code


security

network

<p style="line-height: 2em;" ><span style="font-size: 14px;" >Caused by: java.io.IOException: Connection reset by peer <br> at sun.nio.ch.FileDispatcherImpl.read0(Native Method) <br> at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) <br> at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) <br> at sun.nio.ch.IOUtil.read(IOUtil.java:197)<br></span></p>Copy the code

reference

http://www.cnblogs.com/LBSer/p/4119841.html

http://www.cnblogs.com/yjf512/p/5354055.html

◆ ◆ ◆  ◆ ◆


If you find any mistakes in your article or have any questions about the content, you can leave a message to us in the background by following the wechat official account of the institute of Technology (CE_TECH). Every week, we will select a warm-hearted friend and send a nice small gift. Scan the code to pay attention to us!