I’m currently pulling data from Pipedrive and would like to make a new control filter that would be based on string values in my data.
My index contains Deal_title that is in the form - CompanyName Ltd (xxxx) The information inside the brackets changes.
Correct me if I’m wrong, but in order to have the control visualization I’ll need to do the following:
Create new scripted field that will add a new field in my index
Use that Scripted field for control visualization
The problem is that I have no idea how to write this script that would take my string data and create new index value whenever it finds brackets.
nickpeihl
(Nick Peihl)
August 22, 2019, 11:17pm
2
Sorry, I'm not clear on the question. Can you share some example documents and what you'd expect the control options to be?
Deal title indexing is as follows:
"Deal_title": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
Resulting in:
I'd like to make a new control visualization that would have only the lead source that is in the brackets (maby 5-6 different sources).
I think I'll have to make a new field from deal title data with script field and write code with painless that takes end of string and creates a new field in my index from whatever is inside of those brackets.
I'm new to painless, so I have no idea how to do this.
nickpeihl
(Nick Peihl)
August 23, 2019, 9:01pm
4
Thanks for clarifying. Yes, I think you'll want to use a Painless regular expression in a scripted field for this.
Here's a scripted field example that will extract "Bar" from "Foo (Bar)".
def m = /\((.*)\)/.matcher(doc['name'].value);
if ( m.find() ) {
return m.group(1)
} else {
return ''
}
1 Like
system
(system)
Closed
September 20, 2019, 9:01pm
5
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.