GET / GET /avaliacao/_search { "filter": { "and": [ {"term": { "categoria_1.codigo": 44 }}, {"term": { "estado": "sp" }}, {"range" : {"ano" : {"gte" : "1978", "lte" : "1980" }}}, {"range" : {"lastUpdate" : {"gte" : "now-3y/d","lte" : "now/d" }}} ] } } PUT /avaliacao { "settings": { "index": { "number_of_shards": 5 }, "analysis": { "filter": { "light_pt": { "type": "stemmer", "name": "light_portuguese" }, "minimal_pt": { "type": "stemmer", "name": "minimal_portuguese" } }, "analyzer": { "sort": { "type": "custom", "tokenizer": "keyword", "filter": [ "lowercase", "asciifolding" ] }, "text_search": { "type": "custom", "char_filter": [ "html_strip" ], "tokenizer": "standard", "filter": [ "lowercase", "asciifolding", "light_pt" ] }, "url": { "type": "custom", "char_filter": [ "html_strip" ], "tokenizer": "standard", "filter": [ "lowercase", "asciifolding" ] }, "url_min": { "type": "custom", "char_filter": [ "html_strip" ], "tokenizer": "standard", "filter": [ "lowercase", "asciifolding", "minimal_pt" ] } } } }, "mappings": { "mfavaliacao": { "properties": { "titulo": { "type": "string", "index": "analyzed", "analyzer": "text_search", "fields": { "sort": { "type": "string", "index": "analyzed", "analyzer": "sort" } } }, "cidade": { "type": "string", "index": "analyzed", "fields": { "sort": { "type": "string", "index": "analyzed", "analyzer": "sort" }, "raw": { "type": "string", "index": "not_analyzed" } } }, "estado": { "type": "string", "index": "not_analyzed" }, "id": { "type": "integer" }, "valor": { "type": "float" }, "categoria_1": { "type": "object", "dynamic": false, "properties": { "codigo": { "type": "integer" }, "titulo": { "type": "string", "index": "not_analyzed" }, "titulo_busca" : { "type": "string", "index": "analyzed", "analyzer": "text_search" } } }, "categoria_2": { "type": "object", "dynamic": false, "properties": { "codigo": { "type": "integer" }, "titulo": { "type": "string", "index": "not_analyzed" }, "titulo_busca" : { "type": "string", "index": "analyzed", "analyzer": "text_search" } } }, "categoria_3": { "type": "object", "dynamic": false, "properties": { "codigo": { "type": "integer" }, "titulo": { "type": "string", "index": "not_analyzed" }, "titulo_busca" : { "type": "string", "index": "analyzed", "analyzer": "text_search" } } }, "lastUpdate": { "type": "date" }, "ano": { "type": "integer" }, "tipo": { "type": "string" } } } } }