Hi,
I'm trying to use elastic to find brands in documents. So my idea was to create a index containing brands and search with a text to find brands.
So I tried this index and mapping:
PUT brand
{
"settings": {
"analysis": {
"analyzer": {
"my_analyzer_keyword": {
"type": "custom",
"tokenizer": "keyword",
"filter": [
"asciifolding",
"lowercase"
]
},
"my_analyzer_shingle": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"asciifolding",
"lowercase",
"shingle"
]
}
}
}
},
"mappings": {
"brand": {
"properties": {
"keyword": {
"type": "text",
"analyzer": "my_analyzer_keyword",
"search_analyzer": "my_analyzer_shingle"
}
}
}
}
}
Some documents:
POST /brand/brand/1
{
"id": 1,
"keyword": "nike"
}
POST /brand/brand/2
{
"id": 2,
"keyword": "adidas originals"
}
I then search like this:
POST /brand/brand/_search
{
"query": {
"match": {
"keyword": "I like nike shoes and adidas originals"
}
}
}
I expect to get nike and adidas originals as the result but I don't get anything back.
I'm using elastic 5.4.3.
Is my thinking wrong?