Я хотел бы получить данные из моего индексаasticSearch.
Итак, у меня есть следующий индекс:
С узлом, если я сделаю:
const hits = await elasticClient.search({
index: esIndex,
size: 999,
sort: 'ts:desc',
body: {
query: {
bool: {
must: [
{
term: {
userId: '56',
},
}
],
},
},
},
});
он вернет:
[
{
"_index": "events_rc",
"_type": "_doc",
"_id": "tf-szm0B_tB6kax4xmnr",
"_score": null,
"_source": {
"userId": "56",
"eventName": "synchronizationStart",
"ts": 1571130486383
}
},
{
"_index": "events_rc",
"_type": "_doc",
"_id": "tP-szm0B_tB6kax4xmnr",
"_score": null,
"_source": {
"userId": "56",
"eventName": "showSynchronizationModal",
"ts": 1571130447209
}
}
]
, но если я сделаю следующий запрос:
const hits = await elasticClient.search({
index: esIndex,
size: 999,
sort: 'ts:desc',
body: {
query: {
bool: {
must: [
{
term: {
eventName: 'synchronizationStart',
},
}
],
},
},
},
});
, он вернет пустой массив ...
Я хотел бы знатьпочему он может найти совпадения с userId
, но не с eventName
?
Отображение, кажется, идентично для 2 полей
"eventName": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
"userId": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
thx