作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是映射。
curl -XPUT 'localhost:9200/products/' -d '{
"settings" : {
"index" : {
"number_of_shards" : 6,
"number_of_replicas" : 1
}
},
"mappings" : {
"product" : {
"_all":{ "enabled": true },
"properties":{
"id" : { "type" : "string", "index" : "not_analyzed", "include_in_all": true },
"description" : { "type" : "string" },
"title" : { "type" : "string", "boost" : 2 },
}
}
}
}'
**query => {
filtered => {
filter => {
not => {
filter => {
term => {description => ''}
}
}
},
query => {
match => { _all => $q }
}
}
}**
最佳答案
对于2.4,这将是正确的语法和查询方法:
{
"query": {
"bool": {
"must": [
{"match_all": {}}
],
"filter": {
"bool": {
"must": [
{
"exists": {
"field": "description"
}
},
{
"wildcard": {
"description": "*"
}
}
]
}
}
}
}
}
filtered
之外,您还可以使用带有
bool
的
must
作为查询,并且
filter as filter. What's inside of
必须在ES 2.x中不推荐使用
is what you have as query and what's inside of
过滤器
is what you have as filter. The approach you used with
过滤。
关于elasticsearch - 如何在elasticsearch的索引字段中使用不查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40233211/
我是一名优秀的程序员,十分优秀!