I am searching only by couple of fields but I want to be able to store the whole document in ES in order not to additional DB (MySQL) queries.
I tried adding index: no
, store: no
to whole objects/properties in the mapping but I'm still not sure if the fields are being indexed and add unnecessary overhead.
Let's say I've got books and each has an author. I want to search only by book title, but I want to be able to retrieve the whole document.
Is this okay:
mappings:
properties:
title:
type: string
index: analyzed
author:
type: object
index: no
store: no
properties:
first_name:
type: string
last_name:
type: string
Or should I rather do:
mappings:
properties:
title:
type: string
index: analyzed
author:
type: object
properties:
first_name:
index: no
store: no
type: string
last_name:
index: no
store: no
type: string
Or maybe I am doing it completely wrong?
And what about nested
properties that should not be indexed?