Hi,
I am running into a problem using Full Text Search for this data set.
[
{
"type": "hdr-type",
"value": "Dense"
},
{
"type": "hdr-type",
"value": "Moby D"
},
{
"type": "hdr-type",
"value": "Land"
},
{
"type": "hdr-type",
"value": "Sample"
}
]
This is the query that I use for this data set.
{
"size": 10,
"from": 0,
"query": {
"conjuncts": [
{
"field": "type",
"match_phrase": "hdr-type"
},
{
"disjuncts": [
{
"field": "valueMatch",
"match": "l*d"
},
{
"field": "valueMatch",
"wildcard": "l*d*"
}
]
}
]
}
}
With this data set and the query, I expect the query result only contains document with value = Land
. However, I got back all 4 documents. Any suggestions of where I did wrong is welcomed.
Note:
This is my index definition. I use the ngram tokenizer because I also want to support the use case where search for a single character, i.e. searching for a character d
will give back documents with Moby D
, Land
, and Dense
.
{
"name": "fts_index",
"params": {
"doc_config": {
"docid_prefix_delim": "",
"docid_regexp": "",
"mode": "type_field",
"type_field": "type"
},
"mapping": {
"analysis": {
"analyzers": {
"keyword-tolower": {
"token_filters": [
"to_lower"
],
"tokenizer": "single",
"type": "custom"
},
"standard-no-stop": {
"token_filters": [
"to_lower",
"token-filter-ngram"
],
"tokenizer": "unicode",
"type": "custom"
}
},
"token_filters": {
"token-filter-ngram": {
"max": 20,
"min": 1,
"type": "ngram"
}
}
},
"default_analyzer": "standard",
"default_datetime_parser": "dateTimeOptional",
"default_field": "_all",
"default_mapping": {
"dynamic": true,
"enabled": false
},
"default_type": "_default",
"docvalues_dynamic": true,
"index_dynamic": true,
"store_dynamic": false,
"type_field": "_type",
"types": {
"hdr-type": {
"default_analyzer": "keyword-tolower",
"dynamic": false,
"enabled": true,
"properties": {
"type": {
"dynamic": false,
"enabled": true,
"fields": [
{
"analyzer": "keyword-tolower",
"include_term_vectors": true,
"index": true,
"name": "type",
"type": "text"
}
]
},
"value": {
"dynamic": false,
"enabled": true,
"fields": [
{
"analyzer": "standard-no-stop",
"include_term_vectors": true,
"index": true,
"name": "valueMatch",
"type": "text"
},
{
"analyzer": "keyword-tolower",
"include_term_vectors": true,
"index": true,
"name": "value",
"type": "text"
}
]
}
}
}
}
},
"store": {
"indexType": "scorch",
"kvStoreName": ""
}
},
"planParams": {
"maxPartitionsPerPIndex": 171,
"numReplicas": 0
},
"sourceName": "configuration",
"sourceParams": {},
"sourceType": "couchbase",
"sourceUUID": "35abc23f87205e885d7423a1c4916e0f",
"type": "fulltext-index",
"uuid": "19ab3aa6834410d7"
}