Ich versuche, eine Term-Aggregation mit elastischer Suche für die folgenden Daten mit folgenden Abfrage durchzuführen, bricht die Ausgabe die Namen in Tokens (siehe Ausgabe unten). Also habe ich versucht, den os_name als multi_field abzubilden und kann nun nicht mehr abfragen. Ist es möglich, Index ohne Token zu haben? wie "Fedora Core"?ElasticSearch Begriff Aggregation
Abfrage:
GET /temp/example/_search
{
"size": 0,
"aggs": {
"OS": {
"terms": {
"field": "os_name"
}
}
}
}
Daten:
...
{
"_index": "temp",
"_type": "example",
"_id": "3",
"_score": 1,
"_source": {
"title": "system3",
"os_name": "Fedora Core",
"os_version": 18
}
},
{
"_index": "temp",
"_type": "example",
"_id": "1",
"_score": 1,
"_source": {
"title": "system1",
"os_name": "Fedora Core",
"os_version": 20
}
},
{
"_index": "temp",
"_type": "example",
"_id": "2",
"_score": 1,
"_source": {
"title": "backup",
"os_name": "Yellow Dog",
"os_version": 6
}
}
...
Ausgang:
...
{
"key": "core",
"doc_count": 2
},
{
"key": "fedora",
"doc_count": 2
},
{
"key": "dog",
"doc_count": 1
},
{
"key": "yellow",
"doc_count": 1
}
...
mapp ing:
PUT /temp
{
"mappings": {
"example": {
"properties": {
"os_name": {
"type": "string"
},
"os_version": {
"type": "long"
},
"title": {
"type": "string"
}
}
}
}
}
bitte posten Sie Ihre Mapping . – Thorsten
Hallo @Thorsten, ich habe auch das Mapping hinzugefügt. Vielen Dank. – codeBarer