ES:5.3.0
OS:Linux
java:jdk1.8
#my mapping is below:
============my mappings =============
{
"zhongxing2": {
"mappings": {
"zhongxing2": {
"_all": {
"enabled": false
},
"properties": {
"itemid": {
"type": "keyword",
"store": true
},
"OriginalLog": {
"type": "text",
"store": true,
"term_vector": "with_positions_offsets",
"norms": false,
"index_options": "offsets",
"copy_to": [
"OriginalLog_regex"
],
"analyzer": "log_analyzer"
},
"OriginalLog_regex": {
"type": "text",
"term_vector": "with_positions_offsets",
"norms": false,
"index_options": "offsets",
"analyzer": "log_regex_analyzer"
}
}
}
},
"settings": {
"index": {
"analysis": {
"analyzer": {
"log_analyzer": {
"filter": [
"synonym",
"lowercase",
"log_snow"
],
"type": "custom",
"tokenizer": "log_tokenizer"
},
"log_regex_analyzer": {
"filter": [
"lowercase"
],
"type": "custom",
"tokenizer": "log_tokenizer"
}
},
"tokenizer": {
"log_tokenizer": {
"pattern": "(?=\W)[^-]",
"type": "pattern"
}
}
}
}
}
}
}
========= === ================
I insert 6 item as below
===========doc========
(1) curl -i -X POST -H "'Content-type':'application/json', 'charset':'utf-8', 'Accept': 'text/plain'" -d 'json_data={"appname":"zhongxing2","log_list":[{"itemid":"1885469469509","is_online":"1","detail":"I have a dream","OriginalLog":"017-05-25T14:12:35Z ERROR ops.eps.trans system test in logsearch pythonjava after and search engin"},{"itemid":"1885469469510","is_online":"1","detail":"I have two dream","OriginalLog":"before before before before"}],"request_id":"2222"}' http://123.56.120.196:9449/logpush/zte_log
(2) curl -i -X POST -H "'Content-type':'application/json', 'charset':'utf-8', 'Accept': 'text/plain'" -d 'json_data={"appname":"zhongxing2","log_list":[{"itemid":"1885469469507","is_online":"1","detail":"I have a dream","OriginalLog":"017-05-25T14:12:35Z ERROR ops.eps.trans system test in logsearch gogogo after and search engin"},{"itemid":"1885469469508","is_online":"1","detail":"I have two dream","OriginalLog":"before before before before"}],"request_id":"3333"}' http://123.56.120.196:9449/logpush/zte_log
(3) curl -i -X POST -H "'Content-type':'application/json', 'charset':'utf-8', 'Accept': 'text/plain'" -d 'json_data={"appname":"zhongxing2","log_list":[{"itemid":"1885469469505","is_online":"1","detail":"I have a dream","OriginalLog":"017-05-25T14:12:35Z ERROR ops.eps.trans system test in logsearch before after and search engin"},{"itemid":"1885469469506","is_online":"1","detail":"I have two dream","OriginalLog":"before before before before"}],"request_id":"3333"}' http://123.56.120.196:9449/logpush/zte_log
============= ==== ====
when I use the query as follow
========my query:===========
GET zhongxing2/_search
{
"highlight": {
"pre_tags": "",
"fields": {
"OriginalLog": {
"number_of_fragments": 0,
"no_match_size": 150,
"require_field_match": false,
"fragment_size": 150
}
},
"post_tags": ""
},
"query": {
"bool": {
"filter": [],
"should": [],
"must_not": [],
"must": [
{
"query_string": {
"query": "OriginalLog_regex:pythonjava",
"default_operator": "AND"
}
}
]
}
},
"from": 0,
"size": 20
}
the result is
"highlight": {
"OriginalLog": [
"017-05-25T14:12:35Z ERROR ops.eps.trans system test in logsearch <color=red>pythonjava after and search engin"
]
}
the pythonjava is highlight is #pythonjava# ,because if i use the highlight symbol,the color is disappear ,so i use the "#" instand
========= ======
#but when I use the follow query
GET zhongxing2/_search
{
"highlight": {
"pre_tags": "",
"fields": {
"OriginalLog": {
"number_of_fragments": 0,
"no_match_size": 150,
"require_field_match": false,
"fragment_size": 150
}
},
"post_tags": ""
},
"query": {
"bool": {
"filter": [],
"should": [],
"must_not": [],
"must": [
{
"query_string": {
"query": "OriginalLog_regex:before",
"default_operator": "AND"
}
}
]
}
},
"from": 0,
"size": 20
}
the result is
"highlight": {
"OriginalLog": [
"before before before before"
]
}
"highlight": {
"OriginalLog": [
"017-05-25T14:12:35Z ERROR ops.eps.trans system test in logsearch before after and search engin"
]
}
what's more I have try many times ,but the "before" is not hightlight ?
so I wonder the before is a keyword in es or maybe this a big budge in ES ?
I very puzzled
I make a new test as follow
=============== new doc ====
curl -i -X POST -H "'Content-type':'application/json', 'charset':'utf-8', 'Accept': 'text/plain'" -d 'json_data={"appname":"zhongxing2","log_list":[{"itemid":"1885469469605","is_online":"1","OriginalLog":"before after more and more"},{"itemid":"1885469469606","is_online":"1","OriginalLog":"sure before sure pleasure metre centre centimetre"}],"request_id":"3333"}' http://123.56.120.196:9449/logpush/zte_log
I find only the keyword "more" and "sure" is hightlight ,the other word for example before ,pleasure ,metre ,centre ,centimetre annot highlight
this is why?