Elasticsearch to store account information

(moraleslos) #1


Just recently found ES when doing research about IR (lucene, etc).
Seems like ES fits what I would like to do for a new project-- almost
entirely. Would like to use it solely without the need to use another
NoSQL DB or even a relational one since almost all of my data will
have to be indexed and searched via JSON. I do have a question about
ES though (or advice). Other than searchable data, I will have to
store somewhere user account information (i.e. username, password,
first/last name, etc). Now first thing comes to mind is a relational
DB. But since this data would probably be relatively small and
performance in terms of storing and retrieving is not a factor, could
I just store this as is in ES? I mean I probably could but would like
to know if this is not recommended, if there is a better way of
handling this, etc. The account information will be tied to the
searchable data, but that would be "copied" onto the documents
themselves when indexed. What I'm interested in is the log in data.

Any advice would be appreciated. Thanks.


(James Cook) #2

Your user account data can certainly be stored in ES. It's just another type
of document that you search for and perform CRUD functions on.

If you use a third-party authentication mechanism in your code, you may have
to write an extension to access this data as most (all?) do not have an
extension that will directly access ES for credential data. For example, we
use Spring Security for all authentication and out-of-the-box it has support
for authenticating a user's credentials against a database table, LDAP,
Active Directory, and others. Because many companies have their own way of
authenticating, all of these third-party products provide a programming
interface that can be configured with a custom auth implementation.

We wrote our own auth class https://gist.github.com/1144863 for Spring

-- jim

(moraleslos) #3

Thanks for the response. Will look into Spring Security integration.
I'm assuming you're using ES's Java API?

(James Cook) #4

Yes, we use the Java API for most everything, although we do a lot of SSJS,
so most of our code is a JavaScript facade over the Java API. Since ES uses
JSON as its document format and all query structures it is probably the most
ideal coding environment from a syntax and performance standpoint.

(system) #5