原创

ElasticSearch高级语法

ElasticSearch高级语法

PUT /movie/_doc/1
{
  "name":"Eating an apple a day & keeps the doctor away"
}
GET /movie/_search
{
  "query": {
    "match": {
      "name": "eat"
    }
  }
}
  • 使用analyze api 查看分词状态
    GET  /movie/_analyze
    {
    "field": "name",
    "text":"Eating an apple a day & keeps the doctor away"
    }
    
    DELETE /movie
    
  • 使用结构化的方式重新创建索引
    PUT /movie
    {
    "settings": {
      "number_of_shards": 1,
      "number_of_replicas": 0
    },
    "mappings": {
      "properties": {
        "name":{
          "type": "text","analyzer": "english"
        }
      }
    }
    }
    
    ```
    GET /movie/_search

再次使用analyze api查看分词状态
再次查询eat关键词

```

正文到此结束
本文目录