elasticsearch-query

ElasticSearch mapping the result of collapse / do operations on a grouped documents

瘦欲@ 提交于 2020-03-16 08:11:03
问题 There is a list of conversations and every conversation has a list of messages. Every message has different fields and an action field. We need to consider that in the first messages of the conversation there is used the action A , after a few messages there is used action A.1 and after a while A.1.1 and so on (there is a list of chatbot intents). Grouping the messages actions of a conversation will be something like: A > A > A > A.1 > A > A.1 > A.1.1 ... Problem: I need to create a report

ElasticSearch mapping the result of collapse / do operations on a grouped documents

|▌冷眼眸甩不掉的悲伤 提交于 2020-03-16 08:09:25
问题 There is a list of conversations and every conversation has a list of messages. Every message has different fields and an action field. We need to consider that in the first messages of the conversation there is used the action A , after a few messages there is used action A.1 and after a while A.1.1 and so on (there is a list of chatbot intents). Grouping the messages actions of a conversation will be something like: A > A > A > A.1 > A > A.1 > A.1.1 ... Problem: I need to create a report

Elastic search wildcard query to get sorted results

笑着哭i 提交于 2020-03-03 13:05:13
问题 I have a Elastic Search server setup where am storing company names to be used for for company search, the way it works is: From company name, spaces and dots will be removed and stored in ES in a field called trimmedcompanyname, { "companyName" : "RECKON INFOSYSTEM PRIVATE LIMITED", "trimmedCompanyName" : "reckoninfosystemprivatelimited", "id" : "1079" } now when search comes to my server i remove the spaces and dots and then make request to ES server. The ES request in query format is: GET

Elasticsearch Query Filter for Word Count

≯℡__Kan透↙ 提交于 2020-01-04 05:14:09
问题 I am currently looking for a way to return documents with a maximum of n words in a certain field. The query could look like this for a resultset that contains documents with less than three words in the "name" field but there is nothing like word_count as far as I know. Does anyone know how to handle this, maybe even in a different way? GET myindex/myobject/_search { "query": { "filtered": { "filter": { "bool": { "must": [ { "word_count": { "name": { "lte": 3 } } } ] } }, "query": { "match

Kibana - join in the same index

一曲冷凌霜 提交于 2019-12-25 16:36:09
问题 I have the most basic knowledge in Kibana, and perhaps just a little bit more of Elasticsearch. Is this possible to build a query which will return all items where field_A == field_B? In sql world, it would be something like: select * from MyTalbe as t1 inner join MyTable as t2 on t1.field_A = t2.field_B ? 来源: https://stackoverflow.com/questions/32093820/kibana-join-in-the-same-index

ElasticSearch Multiple Phrases, Multiple Distances

怎甘沉沦 提交于 2019-12-25 16:17:12
问题 We have an application where you can follow keywords such as 'Ford Mustang' and 'Fly Rod'. However when you follow a keyword you can assign a range distance to it. For instance you might be willing to travel 500 miles for a '1969 Ford Mustang' but you may only be willing to travel 20 miles for a 'Fly Rod'. I am trying to figure out the best type of query and how it would be structured so that we could say the following. 1.) Take all followed phrases and pull back the results from the

How to search starting and ending of a sentence in elasticsearch

守給你的承諾、 提交于 2019-12-24 22:18:04
问题 I was trying to search the following two cases case 1: I want to search a name that starts with particular word. For example: name : test name name : name test name : test name test if I search for "test" then it should return me only "test name" and "test name test". case 2: I want to search a name that ends with a particular word. For example: name : test name name : name test name : test name test if I search for "test" then it should return me only "name test" and "test name test" . Can

Elasticsearch date query. People who were born in a certain month

▼魔方 西西 提交于 2019-12-24 11:26:51
问题 I have a field with the following mapping: birthdate: { type: :date, format: :dateOptionalTime } I need to find everyone who were born in month of May (including all years) Another query is to find all people who were born on 'August 25' (including all years) What would be the query for that? 回答1: You can achieve this with a script filter All people born in May of any year: { "query": { "filtered": { "filter": { "script": { "script": "doc.birthdate.date.monthOfYear == 5" } } } } } All people

Elasticsearch: Run aggregation on field & filter out specific values using a regexp not matching values

限于喜欢 提交于 2019-12-24 06:40:42
问题 I'm trying to run an aggregation on a field & ignore specific values! So I've got a field path that holds a heap of different url paths. { "size": 0, "aggs": { "paths": { "terms":{ "field": "path" // Count the no unique path ~> values } } }, "filter": { "bool": { "must_not": [ { "regexp": { // path MUST NOT CONTAIN media | cache "path": { "value": "(\/media\b|\bcache\b)" } } } ] } } } When running this, it doesn't filter out the documents which have a path that contains cache or media ?! If I

How to make union query on Elasticsearch?

随声附和 提交于 2019-12-22 07:59:58
问题 I would like to make a query with UNION and limit. I can explain that query on mysql. (SELECT * FROM table WHERE type='text' LIMIT 3 ) UNION (SELECT * FROM table WHERE type='word' LIMIT 3 ) I tried it on Elasticsearch { "query":{ "dis_max":{ "queries":[ { "from":0, "size":3, "query":{ "match":{ "type":"text" } } }, { "from":0, "size":3, "query":{ "match":{ "type":"word" } } } ] } } } http://localhost:9200/test/table/_search?pretty&source={%22query%22:{%22dis_max%22:{%22queries%22:[{%22query