- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一些Python代码,试图将某些文件解析为AWS ES。下面是代码:
import re
import elasticsearch
import itertools
from elasticsearch import Elasticsearch, RequestsHttpConnection, helpers
from boto3 import client, logging, s3, Session
access_key = 'accesskey'
secret_key = 'secretkey'
bucket = 'bucket'
pattern = '(\d{4}[-]\d{2}[-]\d{2})\s+(\d{2}[:]\d{2}[:]\d{2})\s+(\d{1,3}[.]\d{1,3}[.]\d{1,3}[.]\d{1,3})\s+([GET|PUT|POST]+)\s+([^\s]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+([^\s]+)\s+(\".*?\")\s+(\".*?\")'
folder = 'subfolder/'
host = 'host'
index_name = 'test_index'
es = Elasticsearch(
hosts = host,
connection_class = RequestsHttpConnection,
port = 443,
use_ssl = True,
verify_certs = False)
request_body = {
'settings': {
'number_of_shards': 5,
'number_of_relicas': 0
},
'mappings': {
'logs': {
'properties': {
'date': { 'type': 'date', 'format': 'YYYY-MM-DD' },
'time': { 'type': 'string' },
'client_ip': { 'type': 'ip' },
'method': { 'type': 'string' },
'request': { 'type': 'string' },
'status_code': { 'type': 'integer' },
'bytes': { 'type': 'integer' },
'time_taken': { 'type': 'integer' },
'referrer': { 'type': 'string' },
'user_agent': { 'type': 'string' },
'cookie': { 'type': 'string' }
}
}
}
}
if es.indices.exists('test_index'):
print(index_name + 'Exists')
else:
res = es.indices.create(index = index_name, ignore = [400, 404], body = request_body, request_timeout = 30)
session = Session(
aws_access_key_id = access_key,
aws_secret_access_key = secret_key,
region_name = 'region')
s3 = session.resource('s3')
bucket_name = s3.Bucket(bucket)
data = [obj for obj in list(bucket_name.objects.filter(Prefix=folder)) if obj.key != folder]
bulk_data = []
for obj in data:
body = obj.get()['Body'].read().decode('ISO-8859-1')
match = re.compile(pattern)
for line in body.splitlines():
if not line.startswith('#'):
result = match.search(line)
x = 1
if result is not None:
for i in range(11):
es.index(index = index_name, doc_type = 'logs', body = result.group(x))
x += 1
TransportError(400, 'mapper_parsing_exception')
#Version: 1.0
#Fields: date time cs-ip cs-method cs-uri sc-status sc-bytes time-taken cs(Referer) cs(User-Agent) cs(Cookie)
2016-06-14 18:20:07 1.1.1.1 GET /origin.com/products/PublishingImages/file.png 200 10915 1 "http://www.referrer.com/CategoryPage.aspx?" "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0)" "ASP.NET_SessionId=yjumie0ar12dl; __SessionCookie=7FKbuqkC6pmz2ZKewLVMAjOtKTbLpb8zK8j0TCr+U; __CSALastPageName=XCOaCvdhusg==; __CSALastHierarchy=L7ATLEuRZmXj3ddzXRPF7BVVZFzs=; __CSALastReportSuiteName=0eWICfQzEtcnfMSQ==; __CSARedirectTags=ABOcOdYBWK/O5Rw==; pck=0aa46f231-abc9-cc8d12f4b2d9; __CSCookie=RVqW7dLcpb4QVYDUPoADt5vqtK0oo9QKniVXlY0O83Cet4n73Fah5UvdTzbfayAEgnHsTch/OrCOSTZaK4peWy/1kXq3fX2uHLPbrw4BgXhaZvjRUp4yRhaL+Ug2qcj6pQny6oyot+GPOBP4OgqtbzTZJv7NxykKZHKZRzjYBvBLtbOf9brrzjzeaTbDw7r7SEmVzxQOihmDBGDG0Rn16jC9T8MtbUl3VKz3GojZeLTmYTCXX67oBmnGZPPtV8joGqYrVcHrSj0XKxyeFBluQONFGvEGhw/7TKoshKQfd5oNo7A9eJ+UfEvG51iwT/3ePMd6MvzFMdj+eMuizFcjdas9v+bWH923AYt7rUnb99T8AX6+8cJy0/fj69AkdhG/FTvNQrV05Lpbr5gjL5uy8N4Ng2zsoKMdgrFYalARQNM/8h0i7HhxQyx+OY6PXR0VbTGI=; ETE1=fvClmAi4/MuJaZFB+0Cac7U1k4DgF5ylbBWLfPA5UuABTPG9Xp+KAVSMf3ES0cJm94ok4ZwIQ1Y/AiaX1j7lf6BQpcoI9UwGAe9PUFnpSnxiAlp9I5fSbCJyho3YDa0MoJ9xC7fwwPigfrd7oxdyi8nvCKs5OYcrf0zEAMiMUEMFpaB//Imb3d015qESq0aThMWwhuKwT7C7xyk4Q1mdD0l3kFum4C1g2cbIaNQ5qMJ3M+DJvu7SbjVIAZanGwrt1aZLL/1Eo1MPVEuGmMOj/p6hHtjBc; icxid=1461781512418-308716; gigyaCookieNotification=acknowledged; __PublicSiteRecentSearchesCookie=UeUbHRveUtzmA==; __CSUserIbcIDCookie=dHEe9zrGnQX6OLzOhtqfft1DC571R+670C7m6; __CSUserIbcMonikerCookie=Oiz4bVglhbAzQ==; __qca=P0-455562-1461759; icxid=146512418-3087371016; s_vi=[CS]v1|2B90051D1FEE-4000196D[CE]; s_fid=0C6E0CDA143CF-181DECF8985; ddtLatC=549p52.5p46.5p37p41p55.5p35p105; dtCookie=B66FBB0F22CBB49B863198A2"
2016-06-14 18:20:07 1.1.1.1 GET /origin.com/UI/Core/Images/2c.png 304 204 0 "http://www.referrer.com/CategoryPage.aspx?" "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0)" "ASP.NET_SessionId=yjumie0d5l12dl; __SessionCookie=7FKbuq3luPyu/Tz2ZKewLVMAjOtKTbLpb8zK8j0TCr+U; __CSALastPageName=XCOaFcpXdhusg==; __CSALastHierarchy=L7ATLYBSXZmXj3ddzXRPF7BVVZFzs=; __CSALastReportSuiteName=0eWIC8dcnfMSQ==; __CSARedirectTags=ABOcOxeO5Rw==; pck=0aa46f23-cc8d12f4b2d9; __CSCookie=RVqW7dLcpCsk3wIlGmvZSVdPmNjkdGJ9+zMtfOYdMV/fQBUDLKlF01gkDTUg9IENJq+mVzOR1wbxACRCgIcBWYnPY0O83Cet4n73Fah5UvdTzbfayAEgnHsTch/OrCOSTZaK4peWy/1kXq3fX2uHLPbrw4BgXhaZvjRUp4yRhaL+Ug2qcj6pQny6oyot+GPOBP4OgqtbzTZJv7NxykKZHKZRzjYBvBLtbOf9brrzjOihmDBGDG0Rn16jC9T8MtbUl3VKz3GojZeLTmYTCXX67oBmnGZPPtV8joGqYrVcHrSaSmLvVeYt9ieNaiJRkSNnqZMHN0oj0XKxyeFBluQONFGvEGhw/7TKoshKQfd5oNo7A9eJ+UfEvG51iwT/3ePMd6MvzFMdj+5Fg6MIlBuFYXrwVOwIeuhFcjdas9v+bWH923AYt7rUnb99T8AX6+8cJy0/fj69AkdhG/FTvNQrV05Lpbr5gjL5uy8N4Ng2zsoKMdgrFYalARQNM/8h0i7HhxQyx+OY6PXR0VbTGI=; ETE1=fvClmAi4/MuJaZFB+0Cac7U1k4DPA5UuABTPG9Xp+KAVSMf3ES0cJm94ok4ZwIQ1Y/AiaX1j7lf6BQpcoI9UwGAe9PUFnpSn3YDa0MoJ9xC7fwwPigfrd7oxdyi8nvCKs5OYcrf0zEAMiMUEM//Imb3d015qESq0aThM4W51AmI4EEDdFk2l8aqkDjAE8ZmWwhuKwT7C7xyk4Q1mdD0l3kFum4C1g2cbIaNQ5qMJ3M+DJvu7SbjVIAZanGwrt1aZLL/1Eo1MPVEuGmMOj/p6hHtjBc; icxid=1461418-3071016; gigyaCookieNotification=acknowledged; __PublicSiteRecentSearchesCookie=UeUbHUqUtzmA==; __CSUserIbcIDCookie=dHEe9zrPGNScOhtqfft1DC571R+670C7m6; __CSUserIbcMonikerCookie=Oiz4bVglGrhbAzQ==; __qca=P0-455503562-1461259; icxid=14612418-30873371016; s_vi=[CS]v1|2B917051D1FEE-40001000FA6D[CE]; s_fid=0C6EA0A143CF-1810DF8985; dtPC=-; s_cc=true; dtLatC=54p52.5p46.5p37p4p41p55.5p3p105; dtCookie=B66FBB0F863198A2D45|VVMr1BXU3wx"
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to p
arse"}],"type":"mapper_parsing_exception","reason":"failed to parse","caused_by"
:{"type":"not_x_content_exception","reason":"Compressor detection can only be ca
lled on some xcontent bytes or compressed xcontent bytes"}},"status":400
最佳答案
您似乎正在为11个字段定义映射。以上各项均构成一份文件。在下面的处理代码中,使用正则表达式将 header 分解,然后将每个组件分别作为其自己的文档传递。
它的破坏导致文档外观的映射不是您传递的内容:
In [1]: body = '2016-06-14 18:20:07 1.1.1.1 GET
/origin.com/UI/Core/Images/2c.png 304 204 0 "http://www.referrer.com/CategoryPage.aspx?" "Mozilla/5.0 (Window
...: s NT 6.3; WOW64; Trident/7.0; rv:11.0)" "ASP.NET_SessionId=yjumie0d5l12dl; __SessionCookie=7FKbuq3luPyu/Tz2ZKewLVMAjOtKTbLpb8zK8j0TCr+U; __CSALastPageName=XCOaF
...: cpXdhusg==; __CSALastHierarchy=L7ATLYBSXZmXj3ddzXRPF7BVVZFzs=; __CSALastReportSuiteName=0eWIC8dcnfMSQ==; __CSARedirectTags=ABOcOxeO5Rw==; pck=0aa46f23-cc8d12f4
...: b2d9; __CSCookie=RVqW7dLcpCsk3wIlGmvZSVdPmNjkdGJ9+zMtfOYdMV/fQBUDLKlF01gkDTUg9IENJq+mVzOR1wbxACRCgIcBWYnPY0O83Cet4n73Fah5UvdTzbfayAEgnHsTch/OrCOSTZaK4peWy/1kXq3
...: fX2uHLPbrw4BgXhaZvjRUp4yRhaL+Ug2qcj6pQny6oyot+GPOBP4OgqtbzTZJv7NxykKZHKZRzjYBvBLtbOf9brrzjOihmDBGDG0Rn16jC9T8MtbUl3VKz3GojZeLTmYTCXX67oBmnGZPPtV8joGqYrVcHrSaSmL
...: vVeYt9ieNaiJRkSNnqZMHN0oj0XKxyeFBluQONFGvEGhw/7TKoshKQfd5oNo7A9eJ+UfEvG51iwT/3ePMd6MvzFMdj+5Fg6MIlBuFYXrwVOwIeuhFcjdas9v+bWH923AYt7rUnb99T8AX6+8cJy0/fj69AkdhG/F
...: TvNQrV05Lpbr5gjL5uy8N4Ng2zsoKMdgrFYalARQNM/8h0i7HhxQyx+OY6PXR0VbTGI=; ETE1=fvClmAi4/MuJaZFB+0Cac7U1k4DPA5UuABTPG9Xp+KAVSMf3ES0cJm94ok4ZwIQ1Y/AiaX1j7lf6BQpcoI9Uw
...: GAe9PUFnpSn3YDa0MoJ9xC7fwwPigfrd7oxdyi8nvCKs5OYcrf0zEAMiMUEM//Imb3d015qESq0aThM4W51AmI4EEDdFk2l8aqkDjAE8ZmWwhuKwT7C7xyk4Q1mdD0l3kFum4C1g2cbIaNQ5qMJ3M+DJvu7SbjVI
...: AZanGwrt1aZLL/1Eo1MPVEuGmMOj/p6hHtjBc; icxid=1461418-3071016; gigyaCookieNotification=acknowledged; __PublicSiteRecentSearchesCookie=UeUbHUqUtzmA==; __CSUserIbc
...: IDCookie=dHEe9zrPGNScOhtqfft1DC571R+670C7m6; __CSUserIbcMonikerCookie=Oiz4bVglGrhbAzQ==; __qca=P0-455503562-1461259; icxid=14612418-30873371016; s_vi=[CS]v1|2B9
...: 17051D1FEE-40001000FA6D[CE]; s_fid=0C6EA0A143CF-1810DF8985; dtPC=-; s_cc=true; dtLatC=54p52.5p46.5p37p4p41p55.5p3p105; dtCookie=B66FBB0F863198A2D45|VVMr1BXU3wx"
...: '
In [2]: body.splitlines()
Out[2]: ['2016-06-14 18:20:07 1.1.1.1 GET /origin.com/UI/Core/Images/2c.png 304 204 0 "http://www.referrer.com/CategoryPage.aspx?" "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0)" "ASP.NET_SessionId=yjumie0d5l12dl; __SessionCookie=7FKbuq3luPyu/Tz2ZKewLVMAjOtKTbLpb8zK8j0TCr+U; __CSALastPageName=XCOaFcpXdhusg==; __CSALastHierarchy=L7ATLYBSXZmXj3ddzXRPF7BVVZFzs=; __CSALastReportSuiteName=0eWIC8dcnfMSQ==; __CSARedirectTags=ABOcOxeO5Rw==; pck=0aa46f23-cc8d12f4b2d9; __CSCookie=RVqW7dLcpCsk3wIlGmvZSVdPmNjkdGJ9+zMtfOYdMV/fQBUDLKlF01gkDTUg9IENJq+mVzOR1wbxACRCgIcBWYnPY0O83Cet4n73Fah5UvdTzbfayAEgnHsTch/OrCOSTZaK4peWy/1kXq3fX2uHLPbrw4BgXhaZvjRUp4yRhaL+Ug2qcj6pQny6oyot+GPOBP4OgqtbzTZJv7NxykKZHKZRzjYBvBLtbOf9brrzjOihmDBGDG0Rn16jC9T8MtbUl3VKz3GojZeLTmYTCXX67oBmnGZPPtV8joGqYrVcHrSaSmLvVeYt9ieNaiJRkSNnqZMHN0oj0XKxyeFBluQONFGvEGhw/7TKoshKQfd5oNo7A9eJ+UfEvG51iwT/3ePMd6MvzFMdj+5Fg6MIlBuFYXrwVOwIeuhFcjdas9v+bWH923AYt7rUnb99T8AX6+8cJy0/fj69AkdhG/FTvNQrV05Lpbr5gjL5uy8N4Ng2zsoKMdgrFYalARQNM/8h0i7HhxQyx+OY6PXR0VbTGI=; ETE1=fvClmAi4/MuJaZFB+0Cac7U1k4DPA5UuABTPG9Xp+KAVSMf3ES0cJm94ok4ZwIQ1Y/AiaX1j7lf6BQpcoI9UwGAe9PUFnpSn3YDa0MoJ9xC7fwwPigfrd7oxdyi8nvCKs5OYcrf0zEAMiMUEM//Imb3d015qESq0aThM4W51AmI4EEDdFk2l8aqkDjAE8ZmWwhuKwT7C7xyk4Q1mdD0l3kFum4C1g2cbIaNQ5qMJ3M+DJvu7SbjVIAZanGwrt1aZLL/1Eo1MPVEuGmMOj/p6hHtjBc; icxid=1461418-3071016; gigyaCookieNotification=acknowledged; __PublicSiteRecentSearchesCookie=UeUbHUqUtzmA==; __CSUserIbcIDCookie=dHEe9zrPGNScOhtqfft1DC571R+670C7m6; __CSUserIbcMonikerCookie=Oiz4bVglGrhbAzQ==; __qca=P0-455503562-1461259; icxid=14612418-30873371016; s_vi=[CS]v1|2B917051D1FEE-40001000FA6D[CE]; s_fid=0C6EA0A143CF-1810DF8985; dtPC=-; s_cc=true; dtLatC=54p52.5p46.5p37p4p41p55.5p3p105; dtCookie=B66FBB0F863198A2D45|VVMr1BXU3wx"']
In [3]: import re
In [4]: pattern = '(\d{4}[-]\d{2}[-]\d{2})\s+(\d{2}[:]\d{2}[:]\d{2})\s+(\d{1,3}[.]\d{1,3}[.]\d{1,3}[.]\d{1,3})\s+([GET|PUT|POST]+)\s+([^\s]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+
...: ([^\s]+)\s+(\".*?\")\s+(\".*?\")'
In [5]: match = re.compile(pattern)
In [6]: match
Out[6]: re.compile(r'(\d{4}[-]\d{2}[-]\d{2})\s+(\d{2}[:]\d{2}[:]\d{2})\s+(\d{1,3}[.]\d{1,3}[.]\d{1,3}[.]\d{1,3})\s+([GET|PUT|POST]+)\s+([^\s]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+([^\s]+)\s+(".*?")\s+(".*?")')
In [11]: x.groups()
Out[11]:
('2016-06-14',
'18:20:07',
'1.1.1.1',
'GET',
'/origin.com/UI/Core/Images/2c.png',
'304',
'204',
'0',
'"http://www.referrer.com/CategoryPage.aspx?"',
'"Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0)"',
'"ASP.NET_SessionId=yjumie0d5l12dl; __SessionCookie=7FKbuq3luPyu/Tz2ZKewLVMAjOtKTbLpb8zK8j0TCr+U; __CSALastPageName=XCOaFcpXdhusg==; __CSALastHierarchy=L7ATLYBSXZmXj3ddzXRPF7BVVZFzs=; __CSALastReportSuiteName=0eWIC8dcnfMSQ==; __CSARedirectTags=ABOcOxeO5Rw==; pck=0aa46f23-cc8d12f4b2d9; __CSCookie=RVqW7dLcpCsk3wIlGmvZSVdPmNjkdGJ9+zMtfOYdMV/fQBUDLKlF01gkDTUg9IENJq+mVzOR1wbxACRCgIcBWYnPY0O83Cet4n73Fah5UvdTzbfayAEgnHsTch/OrCOSTZaK4peWy/1kXq3fX2uHLPbrw4BgXhaZvjRUp4yRhaL+Ug2qcj6pQny6oyot+GPOBP4OgqtbzTZJv7NxykKZHKZRzjYBvBLtbOf9brrzjOihmDBGDG0Rn16jC9T8MtbUl3VKz3GojZeLTmYTCXX67oBmnGZPPtV8joGqYrVcHrSaSmLvVeYt9ieNaiJRkSNnqZMHN0oj0XKxyeFBluQONFGvEGhw/7TKoshKQfd5oNo7A9eJ+UfEvG51iwT/3ePMd6MvzFMdj+5Fg6MIlBuFYXrwVOwIeuhFcjdas9v+bWH923AYt7rUnb99T8AX6+8cJy0/fj69AkdhG/FTvNQrV05Lpbr5gjL5uy8N4Ng2zsoKMdgrFYalARQNM/8h0i7HhxQyx+OY6PXR0VbTGI=; ETE1=fvClmAi4/MuJaZFB+0Cac7U1k4DPA5UuABTPG9Xp+KAVSMf3ES0cJm94ok4ZwIQ1Y/AiaX1j7lf6BQpcoI9UwGAe9PUFnpSn3YDa0MoJ9xC7fwwPigfrd7oxdyi8nvCKs5OYcrf0zEAMiMUEM//Imb3d015qESq0aThM4W51AmI4EEDdFk2l8aqkDjAE8ZmWwhuKwT7C7xyk4Q1mdD0l3kFum4C1g2cbIaNQ5qMJ3M+DJvu7SbjVIAZanGwrt1aZLL/1Eo1MPVEuGmMOj/p6hHtjBc; icxid=1461418-3071016; gigyaCookieNotification=acknowledged; __PublicSiteRecentSearchesCookie=UeUbHUqUtzmA==; __CSUserIbcIDCookie=dHEe9zrPGNScOhtqfft1DC571R+670C7m6; __CSUserIbcMonikerCookie=Oiz4bVglGrhbAzQ==; __qca=P0-455503562-1461259; icxid=14612418-30873371016; s_vi=[CS]v1|2B917051D1FEE-40001000FA6D[CE]; s_fid=0C6EA0A143CF-1810DF8985; dtPC=-; s_cc=true; dtLatC=54p52.5p46.5p37p4p41p55.5p3p105; dtCookie=B66FBB0F863198A2D45|VVMr1BXU3wx"')
In [20]: x.groups()
Out[20]:
('2016-06-14',
'18:20:07',
'1.1.1.1',
'GET',
'/origin.com/UI/Core/Images/2c.png',
'304',
'204',
'0',
'"http://www.referrer.com/CategoryPage.aspx?"',
'"Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0)"',
'"ASP.NET_SessionId=yjumie0d5l12dl; __SessionCookie=7FKbuq3luPyu/Tz2ZKewLVMAjOtKTbLpb8zK8j0TCr+U; __CSALastPageName=XCOaFcpXdhusg==; __CSALastHierarchy=L7ATLYBSXZmXj3ddzXRPF7BVVZFzs=; __CSALastReportSuiteName=0eWIC8dcnfMSQ==; __CSARedirectTags=ABOcOxeO5Rw==; pck=0aa46f23-cc8d12f4b2d9; __CSCookie=RVqW7dLcpCsk3wIlGmvZSVdPmNjkdGJ9+zMtfOYdMV/fQBUDLKlF01gkDTUg9IENJq+mVzOR1wbxACRCgIcBWYnPY0O83Cet4n73Fah5UvdTzbfayAEgnHsTch/OrCOSTZaK4peWy/1kXq3fX2uHLPbrw4BgXhaZvjRUp4yRhaL+Ug2qcj6pQny6oyot+GPOBP4OgqtbzTZJv7NxykKZHKZRzjYBvBLtbOf9brrzjOihmDBGDG0Rn16jC9T8MtbUl3VKz3GojZeLTmYTCXX67oBmnGZPPtV8joGqYrVcHrSaSmLvVeYt9ieNaiJRkSNnqZMHN0oj0XKxyeFBluQONFGvEGhw/7TKoshKQfd5oNo7A9eJ+UfEvG51iwT/3ePMd6MvzFMdj+5Fg6MIlBuFYXrwVOwIeuhFcjdas9v+bWH923AYt7rUnb99T8AX6+8cJy0/fj69AkdhG/FTvNQrV05Lpbr5gjL5uy8N4Ng2zsoKMdgrFYalARQNM/8h0i7HhxQyx+OY6PXR0VbTGI=; ETE1=fvClmAi4/MuJaZFB+0Cac7U1k4DPA5UuABTPG9Xp+KAVSMf3ES0cJm94ok4ZwIQ1Y/AiaX1j7lf6BQpcoI9UwGAe9PUFnpSn3YDa0MoJ9xC7fwwPigfrd7oxdyi8nvCKs5OYcrf0zEAMiMUEM//Imb3d015qESq0aThM4W51AmI4EEDdFk2l8aqkDjAE8ZmWwhuKwT7C7xyk4Q1mdD0l3kFum4C1g2cbIaNQ5qMJ3M+DJvu7SbjVIAZanGwrt1aZLL/1Eo1MPVEuGmMOj/p6hHtjBc; icxid=1461418-3071016; gigyaCookieNotification=acknowledged; __PublicSiteRecentSearchesCookie=UeUbHUqUtzmA==; __CSUserIbcIDCookie=dHEe9zrPGNScOhtqfft1DC571R+670C7m6; __CSUserIbcMonikerCookie=Oiz4bVglGrhbAzQ==; __qca=P0-455503562-1461259; icxid=14612418-30873371016; s_vi=[CS]v1|2B917051D1FEE-40001000FA6D[CE]; s_fid=0C6EA0A143CF-1810DF8985; dtPC=-; s_cc=true; dtLatC=54p52.5p46.5p37p4p41p55.5p3p105; dtCookie=B66FBB0F863198A2D45|VVMr1BXU3wx"')
In [22]: doc = dict(zip(('date', 'time', 'client_ip', 'method', 'request', 'status_code', 'bytes', 'time_taken', 'referrer', 'user_agent', 'cookie'),x.groups()))
In [23]: doc
Out[23]:
{'bytes': '204',
'client_ip': '1.1.1.1',
'cookie': '"ASP.NET_SessionId=yjumie0d5l12dl; __SessionCookie=7FKbuq3luPyu/Tz2ZKewLVMAjOtKTbLpb8zK8j0TCr+U; __CSALastPageName=XCOaFcpXdhusg==; __CSALastHierarchy=L7ATLYBSXZmXj3ddzXRPF7BVVZFzs=; __CSALastReportSuiteName=0eWIC8dcnfMSQ==; __CSARedirectTags=ABOcOxeO5Rw==; pck=0aa46f23-cc8d12f4b2d9; __CSCookie=RVqW7dLcpCsk3wIlGmvZSVdPmNjkdGJ9+zMtfOYdMV/fQBUDLKlF01gkDTUg9IENJq+mVzOR1wbxACRCgIcBWYnPY0O83Cet4n73Fah5UvdTzbfayAEgnHsTch/OrCOSTZaK4peWy/1kXq3fX2uHLPbrw4BgXhaZvjRUp4yRhaL+Ug2qcj6pQny6oyot+GPOBP4OgqtbzTZJv7NxykKZHKZRzjYBvBLtbOf9brrzjOihmDBGDG0Rn16jC9T8MtbUl3VKz3GojZeLTmYTCXX67oBmnGZPPtV8joGqYrVcHrSaSmLvVeYt9ieNaiJRkSNnqZMHN0oj0XKxyeFBluQONFGvEGhw/7TKoshKQfd5oNo7A9eJ+UfEvG51iwT/3ePMd6MvzFMdj+5Fg6MIlBuFYXrwVOwIeuhFcjdas9v+bWH923AYt7rUnb99T8AX6+8cJy0/fj69AkdhG/FTvNQrV05Lpbr5gjL5uy8N4Ng2zsoKMdgrFYalARQNM/8h0i7HhxQyx+OY6PXR0VbTGI=; ETE1=fvClmAi4/MuJaZFB+0Cac7U1k4DPA5UuABTPG9Xp+KAVSMf3ES0cJm94ok4ZwIQ1Y/AiaX1j7lf6BQpcoI9UwGAe9PUFnpSn3YDa0MoJ9xC7fwwPigfrd7oxdyi8nvCKs5OYcrf0zEAMiMUEM//Imb3d015qESq0aThM4W51AmI4EEDdFk2l8aqkDjAE8ZmWwhuKwT7C7xyk4Q1mdD0l3kFum4C1g2cbIaNQ5qMJ3M+DJvu7SbjVIAZanGwrt1aZLL/1Eo1MPVEuGmMOj/p6hHtjBc; icxid=1461418-3071016; gigyaCookieNotification=acknowledged; __PublicSiteRecentSearchesCookie=UeUbHUqUtzmA==; __CSUserIbcIDCookie=dHEe9zrPGNScOhtqfft1DC571R+670C7m6; __CSUserIbcMonikerCookie=Oiz4bVglGrhbAzQ==; __qca=P0-455503562-1461259; icxid=14612418-30873371016; s_vi=[CS]v1|2B917051D1FEE-40001000FA6D[CE]; s_fid=0C6EA0A143CF-1810DF8985; dtPC=-; s_cc=true; dtLatC=54p52.5p46.5p37p4p41p55.5p3p105; dtCookie=B66FBB0F863198A2D45|VVMr1BXU3wx"',
'date': '2016-06-14',
'method': 'GET',
'referrer': '"http://www.referrer.com/CategoryPage.aspx?"',
'request': '/origin.com/UI/Core/Images/2c.png',
'status_code': '304',
'time': '18:20:07',
'time_taken': '0',
'user_agent': '"Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0)"'}
In [24]:
关于python - Elasticsearch TransportError(400, 'mapper_parsing_exception'),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39497582/
我正在使用elasticsearch-py在 flex 索引中添加一些字典, 我将字典添加到索引和包含列表的字典,在我的代码中添加了该字典,但它给了我这样的错误: RequestError: Tran
我正在尝试使用 Python 和 Elasticsearch 从索引中读取文档。我收到一个错误,我找不到解决办法。有谁知道我该如何解决这个问题? 我在网上查找了同样的问题,但找不到任何相关的文章/解决
我有一些Python代码,试图将某些文件解析为AWS ES。下面是代码: import re import elasticsearch import itertools from elasticsea
用小的术语列表搜索给出我想要的东西 In [29]: small_list Out[29]: [8096, 8105, 8114, 8116, 8128, 8130] In [30]: sqs.fil
我正在尝试将django-haystack与djangorestframework和elasticsearch一起使用,并遵循了here教程 我在虚拟环境中安装了以下软件包 djangorestfra
我正在通过 Google map 网络服务的 Python 客户端库使用 Google map API 在 Google App Engine 中设置一个项目 我尝试了以下示例代码: import g
我刚开始学习 Elasticsearch,我遇到了一个问题,但我找不到解决这个问题的方法。这是我的问题 File "/home/dat/.local/lib/python2.7/site-packag
我正在使用 Python API 创建 Elasticsearch 索引,如下所示: from elasticsearch import Elasticsearch es = Elasticsearc
创建索引: def create_index(index_name): es=create_elastic_search_object() entry_mapping = {
我正在使用 Python Elasticsearch 在 elasticsearch (v. 1.7) 集群上运行基本过滤器。令人惊讶的是,我可以重复运行完全相同的代码,并以大约 1/2 的时间成功查
导致此错误的主要原因是所选字符串以/开头,或者其中包含许多/符号。 示例:“/ abc / cd / ef” 如果选定的字符串中不包含/,则效果很好。 这是查询正在使用: f1= += ',
我正在尝试使用django-elasticsearch-dsl和Elasticsearch服务器将Django应用程序转换为使用ElsaticBeanStalk部署的AWS ElasticSearch
我在我的 Django 项目中使用 elasticsearch 作为 haystack 的后端。如前所述,我创建了搜索所需的所有内容 here .但是当我搜索时,我抛出了一个回溯错误 Transpor
我正在尝试创建一个管道以在 python 客户端中使用摄取附件处理器插件,如下所示: from elasticsearch import Elasticsearch es = Elasticsea
当我尝试在 elasticsearch 中存储任何内容时,出现错误提示: TransportError(403, u'cluster_block_exception', u'blocked by: [
我是一名优秀的程序员,十分优秀!