Queries are designed to match properties of documents and user 1234 is not a single document.
Elasticsearch, like any other distributed system will have problems with your sorts of query if each user's documents can be spread across different machines. To tackle this you need to bring the related content closer together by either:
- Storing each user's content in a single JSON document e.g.
{"user_uuid":1234, "keywords":["apple", "google"]} - Storing each user's content in a single JSON document but indexing as multiple Lucene documents (see nested type).
- Storing each user's content in separate JSON documents but hosted on the same machine (see parent/child )