Make elasticsearch only return certain fields?

Yep, Use a better option source filter. If you’re searching with JSON it’ll look something like this: { “_source”: [“user”, “message”, …], “query”: …, “size”: … } In ES 2.4 and earlier, you could also use the fields option to the search API: { “fields”: [“user”, “message”, …], “query”: …, “size”: … } This is … Read more

Filename search with ElasticSearch

You have various problems with what you pasted: 1) Incorrect mapping When creating the index, you specify: “mappings”: { “files”: { But your type is actually file, not files. If you checked the mapping, you would see that immediately: curl -XGET ‘http://127.0.0.1:9200/files/_mapping?pretty=1’ # { # “files” : { # “files” : { # “properties” : … Read more