{
"mappings": {
"properties": {
"ProductID": { "type": "integer" },
"ProductName": { "type": "text" },
"ProductType": { "type": "text" },
"StockStatus": { "type": "text" }
}
}
}
Settings de bir değişiklik yapmak istersek sırasıyla; close index, set settings, open index
Search sonuçlarından esnek yanıt alabilmek için analyzer indeximize analyzer oluşturuyoruz.
{
"settings": {
"analysis": {
"analyzer": {
"txt_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"txt_filter"
]
}
},
"filter": {
"txt_filter": {
"type": "asciifolding",
"preserve_original": true
}
}
}
},
"mappings": {
"properties": {
"ProductID": { "type": "integer" },
"ProductName": { "type": "text" },
"ProductType": { "type": "text" },
"StockStatus": { "type": "text" }
}
}
}
{"index":{"_index":"products"}}
{"ProductID":1002,"ProductName":"Phone","ProductType":"E","StockStatus":"Yes"}
{"index":{"_index":"products"}}
{"ProductID":1003,"ProductName":"Tv","ProductType":"E","StockStatus":"Yes"}
{"index":{"_index":"products"}}
{"ProductID":1004,"ProductName":"PC","ProductType":"S","StockStatus":"No"}
...
{
"query": {
"match_phrase": {
"ProductID":454360
}
}
}
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "TV",
"type": "bool_prefix",
"fields": [
"ProductName"
]
}
}
]
}
},
"sort": [
{
"Rating": {
"order": "desc"
}
}
],
"size": 10
}
{
"query": {
"match_all": {}
}
}
{
"query": {
"match_all": {}
}
}
{
"doc": {
"ProductName": "Saat"
}
}
{
"script": {
"source": "ctx._source.StockStatus = params.new_stock_status",
"lang": "painless",
"params": {
"new_stock_status": "Yes"
}
},
"query": {
"term": {
"StockStatus": {
"value": "No"
}
}
}
}