Я используюasticsearch 7, и я сохранил следующий индекс:
PUT myindex
{
"id": 2,
"price": {"amount":10.0, "currency": "EUR"},
"folders": ["Book", "Newspaper"]
}
и хочу создать два запроса:
- дляотсортировать все элементы по цене (без интереса к валюте)
- , чтобы найти все элементы с «Книгой» в качестве папки.
Я попытался сопоставить новый индекс с помощью следующего:
{
"settings" : {
"index" : {
"sort.field" : ["price.amount", "price.currency"],
"sort.order" : ["asc", "asc"]
}
},
"mappings": {
"properties": {
"price": {
"type": "keyword"
},
"currency": {
"type": "keyword"
}
}
}
}
но я получил следующую ошибку:
{
"error": {
"root_cause": [
{
"type": "resource_already_exists_exception",
"reason": "index [myindex/1dsbGhj3RSCwm8Yad6oPOA] already exists",
"index_uuid": "1dsbGhj3RSCwm8Yad6oPOA",
"index": "myindex"
}
],
"type": "resource_already_exists_exception",
"reason": "index [myindex/1dsbGhj3RSCwm8Yad6oPOA] already exists",
"index_uuid": "1dsbGhj3RSCwm8Yad6oPOA",
"index": "myindex"
},
"status": 400
}
спасибо за любую помощь
ОБНОВЛЕНИЕ
@ LeBigCat здесьПример списка документов, для которых я хотел бы создать запросы:
PUT myindex2
{
"id": 2,
"price": {"amount":10.0, "currency": "EUR"},
"folders": ["Book", "Newspaper"]
},
{
"id": 3,
"price": {"amount":15.0, "currency": "EUR"},
"folders": ["Book"]
},
{
"id": 4,
"price": {"amount":3.0, "currency": "EUR"},
"folders": ["Plant"]
},
{
"id": 5,
"price": {"amount":3.0, "currency": "USD"},
"folders": []
}