Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doing fuzzy search or more_like_this query on minhash type? #18

Open
Fred12 opened this issue Mar 15, 2019 · 2 comments
Open

Doing fuzzy search or more_like_this query on minhash type? #18

Fred12 opened this issue Mar 15, 2019 · 2 comments
Labels

Comments

@Fred12
Copy link

Fred12 commented Mar 15, 2019

Hello,
I tried to perform a search query on the stored minhash_field... e.g with the fuzzy search or with the more_like_this query .... but I get an error it cannot use the query on type minhash:

GET /test_minhash/_doc/_search/
{
"query": {
"fuzzy" : {
"minhash_value" : {
"value": "reKED0r9qtIDAC8JIpx8Dw==",
"boost": 1.0,
"fuzziness": 5,
"prefix_length": 0,
"max_expansions": 100
}
}
},
"stored_fields": ["minhash_value"]
}

============================================================
{
"error": {
"root_cause": [
{
"type": "query_shard_exception",
"reason": "failed to create query: {\n "fuzzy" : {\n "minhash_value" : {\n "value" : "reKED0r9qtIDAC8JIpx8Dw==",\n "fuzziness" : "5",\n "prefix_length" : 0,\n "max_expansions" : 100,\n "transpositions" : false,\n "boost" : 1.0\n }\n }\n}",
"index_uuid": "FjpcyDT3RIK__bSA5JG1yg",
"index": "test_minhash"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "test_minhash",
"node": "A_Rbp6ykRxOP6R-KYRZTeA",
"reason": {
"type": "query_shard_exception",
"reason": "failed to create query: {\n "fuzzy" : {\n "minhash_value" : {\n "value" : "reKED0r9qtIDAC8JIpx8Dw==",\n "fuzziness" : "5",\n "prefix_length" : 0,\n "max_expansions" : 100,\n "transpositions" : false,\n "boost" : 1.0\n }\n }\n}",
"index_uuid": "FjpcyDT3RIK__bSA5JG1yg",
"index": "test_minhash",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Can only use fuzzy queries on keyword and text fields - not on [minhash_value] which is of type [minhash]"
}
}
}
]
},
"status": 400
}

what is the best approach how to do this?

@marevol
Copy link
Contributor

marevol commented Mar 15, 2019

See a source code of Fess.
Fess uses copy_bits_to.

@Fred12
Copy link
Author

Fred12 commented Mar 18, 2019

Thanks for the info, however, I was using it in kibana, but I couldnt retieve the bits keyword field in GET...

PUT /test_minhash_test
{
"index":{
"analysis":{
"analyzer":{
"minhash_analyzer":{
"type":"custom",
"tokenizer":"standard",
"filter":["minhash"]
}
}
}
}
}

PUT /test_minhash_test/_doc/_mapping
{
"_doc":{
"properties":{
"message": {
"type":"text",
"copy_to":"minhash_value"
},
"minhash_value":{
"type":"minhash",
"minhash_analyzer":"minhash_analyzer",
"store":true,
"copy_bits_to": "content_minhash_bits"
},
"content_minhash_bits": {
"type": "keyword",
"store":true
}
}
}
}

GET /test_minhash_test/_doc/_search/?pretty&stored_fields=*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants