Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
elasticsearch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cubicweb
cubes
elasticsearch
Commits
9387dfaca9cc
Commit
9387dfaca9cc
authored
8 years ago
by
Arthur Lutz
Browse files
Options
Downloads
Patches
Plain Diff
[ccplugin] add --except-etypes option to skip a given type
parent
ab5d742735e5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ccplugin.py
+7
-2
7 additions, 2 deletions
ccplugin.py
es.py
+4
-1
4 additions, 1 deletion
es.py
with
11 additions
and
3 deletions
ccplugin.py
+
7
−
2
View file @
9387dfac
...
...
@@ -42,6 +42,9 @@
(
'
etype
'
,
{
'
type
'
:
'
string
'
,
'
default
'
:
''
,
'
help
'
:
'
only index a given etype
'
'
[default:all indexable types]
'
}),
(
'
except-etype
'
,
{
'
type
'
:
'
string
'
,
'
default
'
:
''
,
'
help
'
:
'
all indexable types except given etype
'
'
[default:None]
'
}),
]
def
run
(
self
,
args
):
...
...
@@ -56,6 +59,8 @@
if
self
.
config
.
etype
:
etypes
=
(
self
.
config
.
etype
,)
else
:
etypes
=
indexable_types
(
schema
)
etypes
=
indexable_types
(
schema
,
custom_skip_list
=
((
self
.
config
.
except_etype
,)))
assert
self
.
config
.
except_etype
not
in
etypes
if
self
.
config
.
debug
and
not
self
.
config
.
etype
:
print
(
u
'
found indexable_types {}
'
.
format
(
...
...
@@ -60,6 +65,6 @@
if
self
.
config
.
debug
and
not
self
.
config
.
etype
:
print
(
u
'
found indexable_types {}
'
.
format
(
'
,
'
.
join
(
indexable_types
(
schema
)
)))
'
,
'
.
join
(
etypes
)))
for
_
in
parallel_bulk
(
es
,
self
.
bulk_actions
(
etypes
,
cnx
,
...
...
This diff is collapsed.
Click to expand it.
es.py
+
4
−
1
View file @
9387dfac
...
...
@@ -33,7 +33,7 @@
log
=
logging
.
getLogger
(
__name__
)
def
indexable_types
(
schema
):
def
indexable_types
(
schema
,
custom_skip_list
=
None
):
'''
introspect indexable types
'''
...
...
@@ -42,6 +42,9 @@
return
INDEXABLE_TYPES
indexable_types
=
[]
skip_list
=
(
'
TrInfo
'
,
'
EmailAddress
'
)
if
custom_skip_list
:
skip_list
=
skip_list
+
custom_skip_list
print
skip_list
for
eschema
in
schema
.
entities
():
if
eschema
.
type
in
skip_list
:
continue
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment