Hi there,
I create a sample synonym filter like below
PUT /test_index
{
"settings": {
"index" : {
"analysis" : {
"analyzer" : {
"synonym" : {
"tokenizer" : "standard",
"filter" : ["synonym"]
}
},
"filter" : {
"synonym" : {
"type" : "synonym",
"synonyms" : ["girl, woman"]
}
}
}
}
},
"mappings": {
"items": {
"properties": {
"tag": {
"type":"text",
"analyzer": "synonym"
}
}
}
}
}
So when I search for girl
, I can get result of items which contain both girl
and woman
tag.
Also when using _analyze
API to test:
GET test-index/_analyze
{
"analyzer": "synonym",
"text": ["girl"]
}
I get 2 tokens: one is girl
as type and woman
as SYNONYM type.
Hence I wonder that when I search for girl
, it will equal to search for (tag: girl AND tag:woman)
or (tag:girl OR tag:woman)
And during index phase, is woman
added to inverted index when indexing document contains girl
tag ?
The last question is when I update the synonym list by adding man, boy
synonyms and without reindex all of my documents, I still can get result of boy
when searching for man
.
Is that only applied for search phase with query like search (tag:man OR tag:boy)
?
Thanks,