Here is my es settings:
// http://10.94.107.21:9200/ugc
{
"ugc": {
"aliases": {
},
"mappings": {
"article": {
"_all": {
"store": true,
"analyzer": "ik_smart"
},
"properties": {
"authorDept1": {
"type": "string"
},
"authorDept2": {
"type": "string"
},
"authorDept3": {
"type": "string"
},
"authorDept4": {
"type": "string"
},
"authorDept5": {
"type": "string"
},
"authorDisplayName": {
"type": "string"
},
"authorDisplayNamePinYin": {
"type": "string"
},
"authorEmail": {
"type": "string"
},
"authorEmployeeId": {
"type": "string"
},
"authorId": {
"type": "long"
},
"authorUsername": {
"type": "string"
},
"content": {
"type": "string",
"boost": 4.0,
"analyzer": "ik_smart",
"include_in_all": true
},
"id": {
"type": "long"
},
"publishTime": {
"type": "string"
},
"tags": {
"type": "string",
"boost": 10.0,
"analyzer": "ik_smart",
"include_in_all": true
},
"title": {
"type": "string",
"boost": 10.0,
"analyzer": "ik_smart",
"include_in_all": true
}
}
}
},
"settings": {
"index": {
"creation_date": "1480584398456",
"number_of_shards": "5",
"number_of_replicas": "1",
"uuid": "ly7I_JPFQZSX5xRL1XOGow",
"version": {
"created": "2040199"
}
}
},
"warmers": {
}
}
}
curl http://10.94.107.21:9200/ugc/article/_search
response string:
{
"took": 15,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 47,
"max_score": 1.0,
"hits": [
{
"_index": "ugc",
"_type": "article",
"_id": "3858",
"_score": 1.0,
"_source": {
"id": 3858,
"title": "漫谈TCP",
"content": "content of this document",
"publishTime": "Nov 9, 2016 6:10:14 PM",
"tags": [
"tcp"
],
"authorId": 5768,
"authorUsername": "yejianfeng",
"authorDisplayName": "叶剑峰",
"authorDisplayNamePinYin": [
"yejianfeng",
"xiejianfeng"
],
"authorEmail": "yejianfeng@bing.com",
"authorEmployeeId": "05616",
"authorDept1": "CEO",
"authorDept2": "工程生产力部",
"authorDept3": "运力中心",
"authorDept4": "产品技术中心",
"authorDept5": "运力中心技术部"
}
},
{
"_index": "ugc",
"_type": "article",
"_id": "3852",
"_score": 1.0,
"_source": {
"id": 3852,
"title": ""
.......
And, my query json is:
{
"query": {
"filtered":{
"filter":{
"bool":{
"must":{
"bool": {
"must":{"term":{"authorDept2": "工程生产力部"}}
}
},
"must":{
"bool": {
}
},
"must":{
"bool": {
}
}
}
}
}
}
}
the query response:
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}
Is there some wrong usage of my query string?
I hope I can get document from es by filter only.
Thanks