-
-
Save joafeldmann/f1deb5fc7bd43384472e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"attr": { | |
"type": "nested", | |
"properties": { | |
"key": { | |
"type": "string", | |
"index": "not_analyzed" | |
}, | |
"text": { | |
"type": "string" | |
}, | |
"integer": { | |
"type": "integer" | |
}, | |
"float": { | |
"type": "float" | |
}, | |
"date": { | |
"type": "date" | |
} | |
} | |
} |
The mapping allows to store and query user defined values in ES. See example below. You should map the keys in a other databse system to the column name. (ID123 = "User1CustomField", ID456 = "User2CustomField")
{
"attr" : [
{
"key": "ID123",
"text": "Some text"
},
{
"key": "ID456",
"integer": 6
}
]
}
you need to query the mapping with nested queries or filters. See
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-nested-type.html
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-nested-filter.html
Double check your business requirements, since this really makes things complex.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@joafeldmann thanks for posting this! i'm very sloowwly beginning to see where you're headed here, but I'm just getting started on elasticsearch right now, and so my level of understanding is very low.
I'm wondering if you wouldn't mind posting a bit more information/details on how the search would then get executed and employ this solution above? Sorry for the noob-level of understanding here :P