mirror of
https://github.com/veops/cmdb.git
synced 2025-08-08 21:00:26 +08:00
fix case sensitive of ES search
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import six
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
|
|
||||||
from api.extensions import es
|
from api.extensions import es
|
||||||
@@ -129,7 +130,7 @@ class Search(object):
|
|||||||
if "*" in v:
|
if "*" in v:
|
||||||
self._operator2query(operator).append({
|
self._operator2query(operator).append({
|
||||||
"wildcard": {
|
"wildcard": {
|
||||||
attr: v
|
attr: v.lower() if isinstance(v, six.string_types) else v
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
@@ -137,7 +138,7 @@ class Search(object):
|
|||||||
attr = "type_id"
|
attr = "type_id"
|
||||||
self._operator2query(operator).append({
|
self._operator2query(operator).append({
|
||||||
"term": {
|
"term": {
|
||||||
attr: v
|
attr: v.lower() if isinstance(v, six.string_types) else v
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user