我正在使用 *
星号符号在查询中搜索多个字段(例如:我希望所有字段都以 source
开头,所以我指定字段 source. *
) 并将 foobar
的查询指定为字符串。我正在使用 Query String
类型的查询。
我不断收到 NumberFormatException
并且其中有一些字段的映射类型为 long
和 double
。
知道怎么做吗?我需要进行多字段搜索。
我的查询贴在下面:
{
"query": {
"bool": {
"must": [{
"query_string": {
"default_field": "source.*",
"query": "foobar"
}
}],
"must_not": [],
"should": []
}
},
"from": 0,
"size": 100000,
"sort": [],
"facets": {}
}
最佳答案
设置lenient为 true 以忽略基于格式的失败
例子:
"query_string":
{
"default_field": "source.*",
"query": "foobar",
"lenient": true
}
关于ElasticSearch:使用输入字符串搜索多个字段(NumberFormatException),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31596281/