Skip to content

Instantly share code, notes, and snippets.

@andrejsharapov
Created July 9, 2024 07:37
Show Gist options
  • Select an option

  • Save andrejsharapov/ce2c5b02b99de3f5856851fe5766029a to your computer and use it in GitHub Desktop.

Select an option

Save andrejsharapov/ce2c5b02b99de3f5856851fe5766029a to your computer and use it in GitHub Desktop.
Elasticsearch - Kibana - Dev Tools
GET index/_search
{
"query": {
"match_all": {}
}
}
// by id
GET index/_doc/1
// by value
GET index/_search
{
"query": {
"match": {
"u_id": 17063092
}
}
}
// multi search with size
GET index/_search
{
"size": 100,
"query": {
"bool": {
"must": [
{
"match": {
"user_id": 1234
}
//},
//{
// "match": {
// "category_id": 0
// }
}
]
}
}
}
// queries with range
GET index/_search
{
"query": {
"bool": {
"must": [
{
"term": {
"sectionId": 963
}
},
{
"range": {
"sort": {
"lte": 540
}
}
}
]
}
}
}
// hard request (multiple query)
GET index/_search
{
"size": 1000,
"query": {
"bool": {
"must": [
{
"bool": {
"must_not": [
{
"terms": {
"clorg_id": [
10011112,
10011113,
10011114,
10011115,
10011116
]
}
}
]
}
},
{
"bool": {
"must_not": [
{
"terms": {
"pc_uid": [
12345678,
87654321
]
}
}
]
}
},
{
"exists": {
"field": "contract"
}
},
{
"bool": {
"must_not": [
{
"exists": {
"field": "oper_comiss"
}
}
]
}
},
{
"bool": {
"must_not": [
{
"term": {
"pckind_id": 5
}
}
]
}
},
{
"range": {
"date_priem": {
"gte": "2023-12-31T21:00:00"
}
}
},
{
"bool": {
"must_not": [
{
"terms": {
"sobsttype": [
1,
6
]
}
}
]
}
},
{
"term": {
"flag": 1
}
},
{
"bool": {
"must_not": [
{
"term": {
"category_id": 6
}
}
]
}
}
]
}
}
}
================================================
// delete by multiple query
POST news_subscribe/_delete_by_query
{
"query": {
"bool": {
"must": [
{
"match": {
"ext_user_id": -8039
}
//},
//{
// "match": {
// "category_id": 0
// }
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment