ElasticSearch: Unassigned Shards, how to fix?

I have an ES cluster with 4 nodes: number_of_replicas: 1 search01 – master: false, data: false search02 – master: true, data: true search03 – master: false, data: true search04 – master: false, data: true I had to restart search03, and when it came back, it rejoined the cluster no problem, but left 7 unassigned shards … Read more

Delete all documents from index/type without deleting type

I know one can delete all documents from a certain type via deleteByQuery. Example: curl -XDELETE ‘http://localhost:9200/twitter/tweet/_query’ -d ‘{ “query” : { “term” : { “user” : “kimchy” } } }’ But i have NO term and simply want to delete all documents from that type, no matter what term. What is best practice to … Read more

Show all Elasticsearch aggregation results/buckets and not just 10

I’m trying to list all buckets on an aggregation, but it seems to be showing only the first 10. My search: curl -XPOST “http://localhost:9200/imoveis/_search?pretty=1” -d’ { “size”: 0, “aggregations”: { “bairro_count”: { “terms”: { “field”: “bairro.raw” } } } }’ Returns: { “took” : 2, “timed_out” : false, “_shards” : { “total” : 5, “successful” … Read more

elasticsearch bool query combine must with OR

I am currently trying to migrate a solr-based application to elasticsearch. I have this lucene query (( name:(+foo +bar) OR info:(+foo +bar) )) AND state:(1) AND (has_image:(0) OR has_image:(1)^100) As far as I understand this is a combination of MUST clauses combined with boolean OR: “Get all documents containing (foo AND bar in name) OR … Read more

Elasticsearch error: cluster_block_exception [FORBIDDEN/12/index read-only / allow delete (api)], flood stage disk watermark exceeded

When trying to post documents to Elasticsearch as normal I’m getting this error: cluster_block_exception [FORBIDDEN/12/index read-only / allow delete (api)]; I also see this message on the Elasticsearch logs: flood stage disk watermark [95%] exceeded … all indices on this node will marked read-only 5 Answers 5

Make elasticsearch only return certain fields?

I’m using elasticsearch to index my documents. Is it possible to instruct it to only return particular fields instead of the entire json document it has stored? 13 s 13 Yep, Use a better option source filter. If you’re searching with JSON it’ll look something like this: { “_source”: [“user”, “message”, …], “query”: …, “size”: … Read more