Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSELECT with LIKE converted _ symbol into ? #885
Comments
|
what‘s problem? |
|
@shi-yuan Here is the problem. SELECT filed FROM index WHERE field_2 LIKE 'a_b%'It's converted to SELECT filed FROM index WHERE field_2 LIKE 'a-b%'It is converted to |
SELECT filed FROM index WHERE field_2 LIKE 'a&UNDERSCOREb%' |
|
Thank you, it is working. Can you please help one more thing? |
|
you should use query_string: select filed from index where q=query('field_2:a\\?b\\*') |
|
It is not working.
your search query is select filed from index where q=query('field_2:a\\*d')This query result output all 2 docs and not only second one |
|
I test latest version,it's ok,just return |
|
I am using elastic search version 6.6.0,
executing query select filed from index where q=query('filed:a\\*d')response object {
"took": 285,
"timed_out": false,
"_shards": {
"total": 4,
"successful": 4,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 0,
"hits": [
{
"_index": "index",
"_type": "_doc",
"_id": "test_doc_1",
"_score": 0,
"_source": {
"filed": "a*d"
}
},
{
"_index": "index",
"_type": "_doc",
"_id": "test_doc_2",
"_score": 0,
"_source": {
"filed": "asd"
}
}
]
}
}But if it works it should return only data |
|
My explain: {
"from": 0,
"size": 1000,
"query": {
"bool": {
"filter": [
{
"bool": {
"must": [
{
"query_string": {
"query": "filed:a\\*d",
"fields": [],
"type": "best_fields",
"default_operator": "or",
"max_determinized_states": 10000,
"enable_position_increments": true,
"fuzziness": "AUTO",
"fuzzy_prefix_length": 0,
"fuzzy_max_expansions": 50,
"phrase_slop": 0,
"escape": false,
"auto_generate_synonyms_phrase_query": true,
"fuzzy_transpositions": true,
"boost": 1
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
},
"_source": {
"includes": [
"filed"
],
"excludes": []
}
} |
|
What's yours? |
|
我的内容jsoncontent:{"name":"test","page":88,"isNonProfit":true} 我想搜索:name是test; 要如何写? |
Query request
Explain responce
{ "from": 0, "size": 1000, "query": { "bool": { "filter": [ { "bool": { "must": [ { "wildcard": { "field_2": { "wildcard": "a?b", "boost": 1 } } } ], "adjust_pure_negative": true, "boost": 1 } } ], "adjust_pure_negative": true, "boost": 1 } }, "_source": { "includes": [ "filed" ], "excludes": [] } }if I try to equal
Explain output is ok
{ "from": 0, "size": 1000, "query": { "bool": { "filter": [ { "bool": { "must": [ { "match_phrase": { "field_2": { "query": "a_b", "slop": 0, "zero_terms_query": "NONE", "boost": 1 } } } ], "adjust_pure_negative": true, "boost": 1 } } ], "adjust_pure_negative": true, "boost": 1 } }, "_source": { "includes": [ "filed" ], "excludes": [] } }