elasticsearch-2.0

elasticsearch - field filterable but not searchable

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 09:14:17
问题 Using elastic 2.3.5. Is there a way to make a field filterable, but not searchable? For example, I have a language field, with values like en-US . Setting several filters in query->bool->filter->term , I'm able to filter the result set without affecting the score, for example, searching for only documents that have en-US in the language field. However, I want a query searching for the term en-US to return no results, since this is not really an indexed field for searching, but just so I can

What's the fastest manner to retrieve min timestamp from Elasticsearch indices?

余生长醉 提交于 2019-12-25 03:42:16
问题 In my opinion, there are two ways to implement it. But I don't know which is faster, because I don't have much data to test. Like SQL below: SELECT min(occur_time) FROM event_* SELECT occur_time FROM event_* order by occur_time limit 1 回答1: You can run a query, with size:1, sorted by @timestamp ascending, and even include_fields:@timestamp in order to fetch back only the minimum timestamp field: { "size":1, "sort": [{"@timestamp":"asc"}], "_source": { "includes": [ "@timestamp" ] } } 来源:

Elastic in-doc date comparison issue

半世苍凉 提交于 2019-12-24 18:33:54
问题 I have an elastic index with thousands of such docs. { Name: John Doe, FirstJobStartDate: 8/9/2016, FirstJobEndDate:1/4/2019, SecondJobStartDate:7/4/2019, SecondJobEndDate:8/8/2020, ThirdJobStartDate: 1/9/2020, } Except for Name & FirstJobStartDate, any other field is optional and may or may not be present in the doc. I need to get 4 numbers: 1) How many docs have a FirstJobEndDate? That's easy { "size":1, "query": { "filtered": { "filter": { "bool": { "must": [ { "exists": { "field":

ElasticSearch 2.x exists filter for nested field doesn't work

匆匆过客 提交于 2019-12-24 08:50:02
问题 I have the following mapping { "properties": { "restaurant_name": {"type": "string"}, "menu": { "type": "nested", "properties": { "name": {"type": "string"} } } } } I am trying to filter all those documents which have optional "menu" field exists GET /restaurnats/_search { "filter": { "query": { "bool": { "must": [ {"exists" : { "field" : "menu" }} ] } } } } But, when I try the same query to filter those documents which have "restaurant_name", then it works fine. So why nested field check

How to load a index template file into elasticsearch when it starts up?

久未见 提交于 2019-12-23 12:02:11
问题 In elasticsearch v1.5, Index templates can be placed within the config location (path.conf) under the templates directory elasticsearch/config/templates . However, I found this template will not be loaded after I upgrade to v2.3 or v5.3. Is any way to load index template? https://www.elastic.co/guide/en/elasticsearch/reference/1.5/indices-templates.html 回答1: No other way in 2.x or 5.x. This has been removed starting with 2.0.0-beta1 version of Elasticsearch. This was documented here. And

How to match a phrase in elastic-search with expandable prefix and suffix?

与世无争的帅哥 提交于 2019-12-22 01:21:49
问题 We have a use case in which we want to match phrases in elastic-search, but in addition to phrase query we also want to search partial phrases. Example: Search phrase: "welcome you" or "lcome you" or "welcome yo" or "lcome yo" this should match to documents containing phrases: "welcome you" "we welcome you" "welcome you to" "we welcome you to" i.e. we want to maintain the ordering of words by doing a phrase query with added functionality that is returns us results which contains phrase as a

case insensitive elasticsearch with uppercase or lowercase

怎甘沉沦 提交于 2019-12-21 21:28:11
问题 I am working with elastic search and I am facing a problem. if any body gave me a hint , I will really thankful. I want to analyze a field "name" or "description" which consist of different entries . e.g someone want to search Sara. if he enter SARA, SAra or sara. he should be able to get Sara. elastic search uses analyzer which makes everything lowercase. I want to implement it case insensitive regardless of user input uppercase or lowercase name, he/she should get results. I am using ngram

Elasticsearch 2.0: how to delete by query in Java

天大地大妈咪最大 提交于 2019-12-21 12:15:49
问题 I am trying to upgrade to ES 2.0. I have downloaed ES 2.0 and installed it on my Windows machine. In my pom.xml, I have the following: <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>2.0.0-rc1</version> </dependency> <dependency> <groupId>org.elasticsearch.plugin</groupId> <artifactId>delete-by-query</artifactId> <version>2.0.0-rc1</version> </dependency> In my Java code, I did delete by query in the following way when using ES 1.7.3:

Elasticsearch - use a “tags” index to discover all tags in a given string

安稳与你 提交于 2019-12-20 06:48:08
问题 I have an elasticsearch v2.x cluster with a "tags" index that contains about 5000 tags: {tagName, tagID} . Given a string, is it possible to query the tags index to get all tags that are found in that string? Not only do I want exact matches, but I also want to be able to control for fuzzy matches without being too generous. By too generous, a tag should only match if all tokens in the tag are found within a certain proximity of each other (say 5 words). For example, given the string: Model

Children aggregation broken in Elasticsearch 2.1?

六眼飞鱼酱① 提交于 2019-12-20 03:16:52
问题 In investigating the issue in this question I noticed what seems to be a bug in Elasticsearch 2.1. Did I miss one of the breaking changes, or is this an actual bug? With this setup: PUT /test_index { "mappings": { "parent_doc": { "properties": { "name": { "type": "string", "index": "not_analyzed" }, "town": { "type": "string", "index": "not_analyzed" } } }, "child_doc": { "_parent": { "type": "parent_doc" }, "properties": { "name": { "type": "string", "index": "not_analyzed" }, "age": { "type