Skip to content

Instantly share code, notes, and snippets.

@perjerz
Created July 25, 2022 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perjerz/26e70cf773a237c13b18164edbd2e1a5 to your computer and use it in GitHub Desktop.
Save perjerz/26e70cf773a237c13b18164edbd2e1a5 to your computer and use it in GitHub Desktop.
elasticsearch query
GET _search
{
"query": {
"match_all": {}
}
}
GET _cat/indices
GET dev-content
GET dev-content/_search/?size=1000
{
"query": {
"match_all": {}
}
}
GET dev-content/_count
{
"query": {
"match": {
"quillHTMLs.quillHTML": "<p>"
}
}
}
GET dev-content/_search
{
"query": {
"match": {
"quillHTMLs.quillHTML": "<p>"
}
}
}
GET dev-content/_search
{
"query": {
"bool": {
"must_not": [
{
"match": {
"quillHTMLs.quillHTML": "<p>"
}
}
]
}
}
}
GET dev-content/_search
{
"query": {
"bool": {
"filter": { "term": { "pageID": 238 } }
, "should": [
{
"match": {
"context.tokenizedText": {
"query": "หิว"
}
}
}
],
"minimum_should_match": 0
}
}
}
GET dev-content/_search/?size=100
{
"query": {
"bool": {
"should": [
{
"term": {
"context.text": {
"value": "หิว"
}
}
}
]
}
},
"sort": [
{
"@timestamp": {
"order": "asc"
}
}
]
}
GET dev-content/_search/?size=100
{
"query": {
"match": {
"quillHTMLs.quillHTML": "<p>"
}
}
}
POST content/_doc
{
"pageID": 238,
"webPageID": "60e8271554cca90f35aee510",
"webPageName": {
"name": "webPageName",
"cultureUI": "TH"
},
"context": [
{
"type": "cms-next-cms-content-text-rendering",
"text": "การเวลาหมุนไป",
"tokenizedText": "การ เวลา หมุน ไป",
"cultureUI": "TH"
}
]
}
POST content/_update_by_query
{
"query": {
"bool": {
"must": [
{
"match": {
"pageID": 238
}
},
{
"match": {
"webPageID": "60e8271554cca90f35aee510"
}
}
]
}
},
"webPageName": {
"name": "Web Page Name 1",
"cultureUI": "TH"
},
"context": [
{
"type": "cms-next-cms-content-text-rendering",
"text": "การเวลาหมุนไป",
"tokenizedText": "การ เวลา หมุน ไป",
"cultureUI": "TH"
},
{
"type": "cms-next-cms-content-text-rendering",
"text": "ไม่เข้าใจว่าทำไม",
"tokenizedText": "ไม่ เข้า ใจ ว่า ทำไม",
"cultureUI": "TH"
}
]
}
GET content/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"pageID": 238
}
}
],
"should": [
{
"term": {
"webPageName.name": {
"value": "การ"
}
}
},
{
"term": {
"context.tokenizedText": {
"value": ""
}
}
}
]
}
}
}
PUT content
{
"settings": {
"index": {
"analysis": {
"analyzer": {
"my_icu_analyzer": {
"tokenizer": "icu_tokenizer"
}
}
}
}
},
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
},
"pageID": {
"type": "integer",
"index": true
},
"webPageID": {
"type": "keyword",
"index": true,
"ignore_above": 24
},
"webPageName": {
"type": "nested",
"properties": {
"name": {
"type": "text",
"analyzer": "my_icu_analyzer",
"index": true
},
"cultureUI" : {
"type": "keyword",
"ignore_above": 4,
"index": true
}
}
},
"context": {
"type": "nested",
"properties": {
"payload": {
"type": "text",
"analyzer": "my_icu_analyzer",
"index": true
},
"payloadNLP": {
"type": "text",
"index": true
},
"cultureUI" : {
"type": "keyword",
"ignore_above": 4,
"index": true
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment