Article From:https://www.cnblogs.com/jinxiao-pu/p/9123526.html

10-1 elasticsearch introduction.

 

the big company currently using es: https://www.elastic.co”/use-cases

 

Mongodb redis”elasticsearch is a joke in front of you!

 

10-2 elasticsearch installation.

 

10-3elasticsearch-head plug-in and kibana installation.

 

 

to download firstjava installation

Java -version” check if it is installed

https://github.com/med”Cl/elasticsearch-rtf

the mistakes you met

  1. Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME

     

    the solution:

    to addjdk configuration towindows in the environment”

    JAVA_HOME    

    C:\Program Files\Java\jdk1.8.0_131

  1. it should not be at this time.” \elasticsearch-rtf-master\bin\\..\config\jvm.options.”

     

    the solution:

    installationhead plug-in:

    downloading https://github.com/mobz/elasticsearch-head downloading https://nodejs.org/en/ installationnodejs

    install wellnodejs it is installed.”npm     can be usednpm -v test

     

    recommended usecnpm npm install -g cnpm –registry=https://registry.npm.taobao.org

     

     

    the whole installationelasticsearch” can be used by Baidu.

     

     

    start order”

     

    startelasticsearch Directelasticsearch.bat

     

    start head Directcnpm run start

     

    startkibana Directkibana.bat

     

     

     

     

    10-4 elasticsearch’s basic concept.

     

     

     

     

     

    10-5 inverted index.

     

    < > is the last place, and the last is the number of times.

    elasticsearch has done us well.

     

     

    10-6 elasticsearch basic index and document CRUD operation.

     

    10-7 elasticsearch”mget andbulk 

    10-8 elasticsearch”mapping

     

     

    10-9 elasticsearch’s simple query — 1

     

     

     

    10-10 elasticsearch”– 2

    10-11 elasticsearch”bool combination query

    GET _search 

     

    >).

     

     

     

    CRUD operation

    > index initialization operation

    > once set, it can not be modified.Be careful

    > 5 pieces, 1 copies.”

     

    PUT Lagou

    >).

     

     

    GET lagou/_settings

    > gets all the indexessetting

    GET _all/_settings

    GET _settings

    > gets the specified indexsetting

    GET.Kibana, lagou/_settings

     

    # Modify settings
    PUT lagou/_settings
    {
    “number_of_replicas”: 2
    }

     

     

    # gain index information

    GET _all

    GET lagou

     

    #put_id, can be designated by itself

    PUT lagou/job/1

    {

      “name”:”ppp”,

      “age”:12

    }

    #post insert data, can not_id, he will generate one at random.”_id

    POST lagou/job/

    {

      “name”:”ppp”,

      “age”:13

    }

     

     

    # only view a record

    GET lagou/job/1

    # only view a field of a record.

    GET lagou/job/1?_source=name,age

     

     

    # put the revision of the article is as long as it is_id is the same, that will cover it directly.”

    PUT lagou/job/1

    {

      “name”:”ppp”,

      “age”:12,

      “gender”:”male”

    }

    # post can specify a field to make a modification, do not use all the fields

    # post

    POST lagou/job/1/_update

    {

      “doc”: {

        “name2”: “hello”

      }

    }

     

    delete

    delete a record

    > multiple queries

    create index

    job”: {

    Properties”:{

    name”: {

    ” “type” “:”Keyword “

    age”: {

    ” “type” “:”Integer “

    gender”: {

    ” “type” “:”Text “

    ” name “:” pujinxiao.”,

    age”: 34,

    gender”: “male”.

    query”query

    andmatch the difference

    does not give words to the query terms, butmatch

    term”: {

    title” title “:” flint”

    match”: {

    title” title “:” flint”

    terms”: {

    title”: “[“ flint”“,”python”]

    control the number of returns of the query

    term”: {

    title”: “[“ flint”“,”python”]

    from”: 0,

    size”: 2

    query”

    phrase query

    he will separate the contents of the inquiry.slop is the middle length of participle, you can control yourself.

    match_phrase”:{

    title”: {

    >” query “:” the creation of flint stone,

    multi_match”:{

    query” query “:” flint”“,

    Fields”: “t”.Itle “,” summary “]

    title issummary

    ” fields “:” [title^]3 “,” summary “]

    > specifies the fields returned.excludes is the exclusion of this field

    includes”: “t”Itle “]

    match”: {

    title” title “:” flint”

    throughsort} match_all”: {}

    update_time” update_time.: {

    >” order “:” d “.ESC “

    query scope

    query”

    range”: {

    publish_time” publish_time.Stamp “: {

    #fefef2″ GTE “:” 2016-08-24 18:58:00.0 “,

    #fefef2″ LTE “:” 2016-08-24 19:58:00.0 “

    query”

    support wildcard query

    includes”: “t”Itle “]

    wildcard”: {

    title”: {

    >” value “:” P “.Yth*n “

    combination query

    query”

    usebool includingmust should must_not filter to complete, the format is as follows

    must be all satisfied

    as long as one can be satisfied

    must not be satisfied with one

    the simplestfilter query”

    salary”20

    change toterms can be[ ] bool”: {

    filter”: {

    term”: {

    salary”:Twenty

    view the result of the parsing of the participleik_max_word andik_smart 2 word segmentation method”

    GET _analyze”python Network Development Engineer

    ” analyzer “:” ik_m.Ax_word “,

    ” text “:” python. Network Development Engineer

    GET _analyze”python Network Development Engineer

    ” analyzer “:” ik_s.Mart “,

    ” text “:” python. Network Development Engineer

    > filter query, can be used as a combination query

    query salary equals20k” or work forpython excludes the price.”30k

    bool”: {

    should”:

    {{” term “{” {

    salary”:{

    value” value.”20″

    {{” term “{” {

    title”:{

    value” value.”Python”

    must_not”:

    {{” term “{” {

    salary”:{

    value” value.”30″

    nested query

    bool”: {

    should”:

    term”: {

    “”: {

    “E “:” 20 “”

    {{” bool “{” {

    must”:

    “: {

    “E “: {

    “Lue “:” Python “”

    “”: {

    “Lary “: {

    “Value “:” 30 “”

    must_not”:

    term”: {

    “”: {

    “E “:” 30 “”

    null

    bool”: {

    must_not”: {

    exists”: {

    field”:”Content”

     

    10-12 scrapy write data toelasticsearch– 1

    10-13″ scrapy write data toelasticsearch2″

     Elasticsearch-dsl

     

    # Take out the HTML label

    from w3lib.html import remove_tags”

    remove_tags (u'< span> 1000< /span&”)Gt; ‘)

     

    11-3 django realizationelasticsearch search suggestion”– 1

    Es fuzzy  

    GET /_search

     {

       “query”: {

         “fuzzy”: {

           “title”: {

             “value”: “linx”,  

             “fuzziness”: 2,   # edit distance should be less than equal to equal2 step”

             “prefix_length”: 2   # 2 li do not participate in editors’ calculation

           }

         }

       }

     }

      > refers to a method of calculating similarity between strings.

      insert delete replacement > adjacent exchange position the minimum number of operations.

      for example:ed(“linux”,”linx”)==1 as long as it is deletedu it’s OK.”

     

      mainly to realize intelligent hints

    an interface that can be monitoredscrapyA good thing

Similar Posts:

Link of this Article: Chapter 10-12 summary

Leave a Reply

Your email address will not be published. Required fields are marked *