Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src_filter not working #178

Open
hobbesuk opened this issue Nov 22, 2019 · 2 comments
Open

src_filter not working #178

hobbesuk opened this issue Nov 22, 2019 · 2 comments

Comments

@hobbesuk
Copy link

abc --version
Version:    0.6.7
Variant:    !oss
Go version: go1.11.1
OS:         linux
Arch:       amd64

I'm trying to import only one collection from a mongodb database which has three collections, but I think because two of my collections are similarly named the regex picks up both, this then fails in elastic because it tries to create two mapping types, e.g. I see this on the import:

INFO[0000] Connection to mongo_server:27017 established. 
INFO[0000] collection count                              db="data" num_collections=3
INFO[0000] adding for iteration...                       collection="market_raw_data" db="data"
INFO[0000] adding for iteration...                       collection="raw_data" db="data"
INFO[0000] skipping iteration...                         collection=updateQueue db="data"
INFO[0000] done iterating collections                    db="data"

My transform file looks like:

t.Source("source", source, "/raw_data/")
       .Mapping({
		"raw_data": {
			"properties":{
				"mongo_id" : {
					"properties" : {
				            "date": {
            					"type":"date",
	            			        "format": "yyyyMMdd"
		                        	}
					}
				}
			}
		}
	})
	// more transforms
	.Save("sink", sink, "/.*/")

How can I exclude it from picking up this collection:

INFO[0000] adding for iteration... collection="market_raw_data" db="data"

@adrianovieira
Copy link

adrianovieira commented May 11, 2021

same behavior here for:

$ abc --version                                                           
Version:    1.0.0-beta.2
Variant:    !oss
Go version: go1.11.13
OS:         linux
abc import --src_filter="table3" ...

neither

abc import --src_filter="public.table3" ...

@zhuyuhuanba
Copy link

src_filter option will not work when you are using a transform file. In that case, put the filter in the namespace selector in .Source method.
for example in postgresql:
t.Source("source", source, "/.*test_schema.test_table")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants