ElasticSearch DSL 예
13663 단어 esdslelasticsearch조회
PUT /megacorp/employee/4
{
"first_name": "Jay",
"last_name": "Smith",
"age": 27,
"about": "I love rock music",
"interests": [
"sports",
"music"
]
}
POST /megacorp/employee
{
"first_name": "Jay",
"last_name": "Smith",
"age": 27,
"about": "I love rock music",
"interests": [
"sports",
"music"
]
}
GET /megacorp/employee/_search
{
"query": {
"match": {
"about": "cabinets"
}
}
}
GET /megacorp/employee/_search
{
"query": {
"match_phrase": {
"about": "build cabinets"
}
}
}
GET /megacorp/employee/1
GET /megacorp/employee/1?pretty
GET /megacorp/employee/_search
GET /megacorp/employee/_search?q=last_name:Zhong
GET /megacorp/employee/_search
{
"query": {
"match": {
"last_name": "Zhong"
}
}
}
GET /megacorp/employee/_search
{
"query": {
"filtered": {
"filter": {
"range": {
"age": {
"lt": 30
}
}
},
"query": {
"match": {
"last_name": "Zhong"
}
}
}
}
}
GET /megacorp/employee/_search
{
"query": {
"match": {
"last_name": "Zhong"
}
},
"highlight": {
"fields": {
"last_name": {}
}
}
}
GET /megacorp/employee/_search
{
"aggs": {
"all_interests": {
"terms": {
"field": "interests"
}
}
}
}
GET /megacorp/employee/_search
{
"query": {
"match": {
"last_name": "Zhong"
}
},
"aggs": {
"all_interests": {
"terms": {
"field": "interests"
}
}
}
}
GET /megacorp/employee/_search
{
"aggs": {
"all_interests": {
"terms": {
"field": "interests"
},
"aggs": {
"avg_age": {
"avg": {
"field": "age"
}
}
}
}
}
}
GET /_cluster/health
PUT /blogs
{
"settings": {
"number_of_shards": 6,
"number_of_replicas": 1
}
}
PUT /blogs/_settings
{
"number_of_replicas": 0
}
GET /megacorp/employee/_search?_source=age,interests
GET /megacorp/employee/1
GET /megacorp/employee/1/_source
PUT /website/blog/2?op_type=create
{
"first_name": "Jay",
"last_name": "Smith",
"age": 27,
"about": "I love rock music",
"interests": [
"sports",
"music"
]
}
PUT /website/blog/122/_create
{
"first_name": "Jay",
"last_name": "Smith",
"age": 27,
"about": "I love rock music",
"interests": [
"sports",
"music"
]
}
DELETE /website/blog/2
PUT /website/blog/2?version=13&version_type=external
{
"title": "My first external blog entry",
"text": "This is a piece of cake..."
}
GET /website/blog/2
POST /website/blog/2/_update
{
"doc": {
"tags": [
"testing"
],
"views": 0
}
}
POST /_mget
{
"docs": [
{
"_index": "website",
"_type": "blog",
"_id": 2
},
{
"_index": "megacorp",
"_type": "employee",
"_id": 1,
"_source": "age"
}
]
}
POST /megacorp/employee/_mget
{
"ids": [
"2",
"111"
]
}
POST /_bulk
{"delete":{"_index":"website","_type":"blog","_id":"223"}}
{"create":{"_index":"website","_type":"blog","_id":"223"}}
{"title":"My first blog post"}
{"index":{"_index":"website","_type":"blog"}}
{"title":"My second blog post"}
{"update":{"_index":"website","_type":"blog","_id":"223","_retry_on_conflict":3}}
{"doc":{"text":"My updated blog post"}}
POST /_bulk
{"create":{"_index":"website","_type":"blog","_id":"123"}}
{"title":"Cannot create - it already exists"}
{"index":{"_index":"website","_type":"blog","_id":"123"}}
{"title":"My first external blog entry","text":"This is a piece of cake..."}
POST /website/blog/_search
GET /megacorp/_search
GET /megacorp/employee/_mapping
GET /_analyze?analyzer=english
{
"text": "Textes to analyze 5 32 "
}
GET megacorp/employee/_mapping
DELETE /megacorp2
PUT /megacorp2
{
"mappings": {
"employee": {
"properties": {
"about": {
"type": "string",
"analyzer": "english"
},
"age": {
"type": "long"
},
"first_name": {
"type": "string",
"index": "not_analyzed"
},
"interests": {
"type": "string"
},
"last_name": {
"type": "string",
"index": "no"
}
}
}
}
}
PUT /megacorp2/_mapping/employee
{
"properties": {
"about": {
"type": "string",
"analyzer": "english"
},
"age": {
"type": "long"
},
"first_name": {
"type": "string",
"index": "not_analyzed"
},
"interests": {
"type": "string"
},
"last_name": {
"type": "string",
"index": "no"
}
}
}
PUT /megacorp2/employee/1
{
"first_name": "Jays ",
"last_name": "Smith",
"age": 27,
"about": "I love rock music ",
"interests": [
"sports",
"music"
]
}
POST /megacorp2/employee
{
"first_name": "Jays efe ",
"last_name": "Smith",
"age": 27,
"about": "sfdf does you're I love rock music ",
"interests": [
"sports",
"music"
]
}
PUT /megacorp/employee/66
{
"first_name": [
"sports",
"music"
],
"last_name": "Smith",
"age": 27,
"about": "I love rock music ",
"interests": [
"sports",
"music"
]
}
GET /megacorp2/_search
{
"query": {
"match": {
"last_name": "Smith"
}
}
}
POST megacorp/_search
PUT gb
{
"tweet": {
"properties": {
"tweet": {
"type": "string"
},
"user": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"gender": {
"type": "string"
},
"age": {
"type": "long"
},
"name": {
"type": "object",
"properties": {
"full": {
"type": "string"
},
"first": {
"type": "string"
},
"last": {
"type": "string"
}
}
}
}
}
}
}
}
PUT gb/tweet/1
{
"tweet": "Elasticsearch is very flexible",
"user": {
"id": "@johnsmith",
"gender": "male",
"age": 26,
"name": {
"full": "John Smith",
"first": "John",
"last": "Smith"
}
}
}
GET /gb/tweet/_search?pretty
GET /gb/tweet/_validate/query?explain
{
"query": {
"match": {
"tweet": "really powerful"
}
}
}
GET /_search
{
"query": {
"filtered": {
"query": {
"match": {
"email": "business opportunity"
}
},
"filter": {
"term": {
"folder": "inbox"
}
}
}
}
}
GET /_search
{
"query": {
"filtered": {
"filter": {
"term": {
"user_id": 1
}
}
}
},
"sort": {
"date": {
"order": "desc"
}
}
}
GET gb/tweet/_search
GET gb/tweet/_search
{
"query": {
"filtered": {
"query": {
"match": {
"tweet": "Elasticsearch is very flexible"
}
},
"filter": {
"term": {
"user.id": "@johnsmith"
}
}
}
},
"sort": [
{
"user.id": {
"order": "desc"
}
},
{
"_score": {
"order": "desc"
}
}
]
}
GET /gb/tweet/1/_explain
{
"query": {
"filtered": {
"filter": {
"term": {
"user.id": "@johnsmith"
}
},
"query": {
"match": {
"tweet": "Elasticsearch is very flexible"
}
}
}
}
}
GET /gb/tweet/1/_explain
{
"query": {
"filtered": {
"filter": {
"term": {
"user.id": "@johnsmith"
}
},
"query": {
"match": {
"tweet": "Elasticsearch"
}
}
}
}
}
GET /megacorp/_search?search_type=scan&scroll=1m
{
"query": {
"match_all": {}
},
"size": 1000
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
elasticsearch 검색엔진의 상용 방법 (一) filter와query1. 필터는 관련성을 계산하지 않기 때문에 필터 속도가query보다 빠르다. 1. filter 단일 조건 조회 2. filter 다중 조건 조회 둘째,query 조회 상하문, 관련도 계산 query 조회의 필터 조건...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.