Elasticsearch learning portal (B): a simple learning portal

A, ES concepts

Index
_inde, document storage areas, similar to the relational data in the database.
In fact, data is stored in the slice and the index, the index is just a fragment of one or more logical space grouped together. Index names must be all lowercase, not allowed to begin with an underscore, can not contain commas.
Document
document id is a string, when combined with _index, you can uniquely identify a document in the ElasticSearch. When you create a document, you can customize _id, but also allows automatic generation of ES help.

Second, the use postman learning portal

  • Create index
    creates an index database format: Use the put request: ip: 9200 / {index}
    Here Insert Picture Description
    red box which is designated type before ES7, now is not necessary to use the default _doc for the type, see some It says the document type will be completely removed in 8.x inside.
{
     "settings":{
        "number_of_shards":3,
        "number_of_replicas":1
    },
    "mappings": {
        
        "properties": {
            "id": {
                "type": "long",
                "store":true
            },
            "title": {
                "type": "text",
                "store":true,
                "index":true,
                "analyzer": "standard"
            },
            "content": {
                "type": "text",
                "store":true,
                "index":true,
                "analyzer": "standard"
            }
        }
        
}
}

number_of_shards is used to set the number of fragments, number_of_replicas is used to set the number of copies. Add your own fields in the properties inside and specify the type of propertyHere Insert Picture Description

  • Remove the index
    format: DELETE IP: 9200 / {index }
  • Creating a document and modify documents
    * Insert Document Format: PUT (POST) IP: 9200 / {index} / _ doc / id specified document ID
    the POST the IP: 9200 / {index} / _ random ID * DOC
    Here Insert Picture Description
    Here Insert Picture Description
  • Modify the document
    * Format: POST IP: 9200 / {index } / _ doc / Document ID *
    in fact and almost new, is to delete the original in the new.
  • Deleting a document
    * Format: DELETE IP: 9200 / {index } / _ doc / document ID *
  • Archie
    * Format: GET IP: 9200 / {index } / _ doc / ID document
    format: POSTIP: 9200 / {index} / _ doc / _search *
    Here Insert Picture Description

    Third, the tokenizer

  • Standard tokenizer
    Here Insert Picture Description
    can not see a good standard word processing Chinese pair
  • IK word breaker
    1. Download https://github.com/medcl/elasticsearch-analysis-ik/releases
    2. In the / plugins below to create a folder named ik, then downloaded via ftp pass word ik folder, and extract
    3 restart ES
    the IK word has two algorithms, ik_smart (split coarse-grained) and ik_max_word (granular split)
    Here Insert Picture Description
    Here Insert Picture Description
    custom dictionary
    needs to be configured inside the extended IKAnalyzer.cfg.xml dictionary is OK Here Insert Picture Description
    but the dictionary file format format utf-8 (do not select utf-8 BOM)

Guess you like

Origin www.cnblogs.com/yangk1996/p/11184076.html