How can we map kendo UI query to elastic search query..
here is my standard Kendo query..
filter:{
logic:and,
filters:[
{
field:"firstname",
operator:"eq",
value:"john"
},
{
field:"lastname",
operator:"eq",
value:"doe"
},
{
field:"faiser",
operator:"lte",
value:"doe"
},
{
field:"faiser",
operator:"lte",
value:"doe"
}
]
},
sort:{
field:"fullname",
dir:"asc",
},
{
field:"fullname",
dir:"desc",
}
Can we search this result from elastic search
Both types of search are quite different and mapping them would be quite difficult. If you want to perform the search on the server I would rather recommend you to generate the endpoint url according to Elastic search syntax and consume it directly with the Kendo DataSource as it comes. If you need a client side filter for part of the data you could use the Kendo query syntax.
Related
I'm using Contentful's GraphQL API. What I want to do is to query all the events that haven't past yet.
I tried using lt, but that doesn't seem to be working. I also found out that the date is a string, so what options do I have?
eventCollection(where: {eventEndDate: {lt: "2022-10-27T00:00:00.000-06:00"}}){
items {
slug
eventEndDate
}
}
A normal query (without the where condition) gives you:
"eventCollection": {
"items": [
{
"slug": "black-friday",
"eventEndDate": "2022-11-27T12:00:00.000-07:00"
}
]
}
You should have an eventEndDate_gte filter available. On every field, there will be type dependent filter available. It's best to use GraphiQL or the GraphQL Playground to discover available filter options.
The following filter works fine for my space.
query {
tilPostCollection(where: {date_gte: "2022-09-05T00:00:00.000+02:00"}) {
items {
title
date
}
}
}
I need to group data in a table by using a particular field in the table. And couldn't find GROUP BY feature in GraphQL. Is there any way to achieve that ?
Current Format :
[
{
"my_state":"karnatak",
"from_state":"kerala",
"route":"wayanad"
},
{
"my_state":"karnatak",
"from_state":"kerala",
"route":"Mangalore"
},
{
"my_state":"karnatak",
"from_state":"kerala",
"route":"Palakkad"
},
{
"my_state":"karnatak",
"from_state":"tamilnadu",
"route":"hosure"
},
{
"my_state":"karnatak",
"from_state":"tamilnadu",
"route":"selam"
},
{
"my_state":"karnatak",
"from_state":"tamilnadu",
"route":"chennai"
}
]
Required Format:
from_state: "karnatak",
route: [
{
route: "chennai"
},
{
route: "selam"
},
............
]
GraphQL is a query language for APIs and it does not really "contain features" like GroupBy, Count, Sort, etc. Those features or queries have to be implemented in the server (GraphQL API) and it leaves you a couple of options:
If you own the API(server) then you would have to create your own "GroupBy query" that would allow you to fetch the data the way you would like.
If you are just using the API you can use the schema documentation to search if there is a query format that satisfies your need.
You can also make your own groupBy function after fetching the data, there's some good examples in these answers.
I need to query data from several shards. Elasticsearch REST API provides a possibility to send a request with several routing keys:
//https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-routing-field.html#_searching_with_custom_routing
GET my-index-000001/_search?routing=user1,user2
{
"query": {
"match": {
"title": "document"
}
}
}
Is it possible to do the same by NEST client?
Yes, you can pass a comma-separated string to the Routing() method of a search request.
I have enabled Aws DynamoDB streams and created a lambda function to index the data into Elasticsearch.
In my DynamoDb table there is a column named URL in this i am going to store the list of URL's for a single row.
URL is most preferably like object URL of AWS S3 objects
After streaming i am indexing the data into elastic search here my question is what is the datatype should i prefer to store multiple URL in both DynamoDB (single row) and Elasticsearch (Single document)
Could some one help me to achieve this in most efficient way? Thanks in advance
Json structure
{
"id":"234561",
"policyholdername":"xxxxxx",
"age":"24",
"claimnumber":"234561",
"policynumber":"456784",
"url":"https://dgs-dms.s3.amazonaws.com/G-3114_Textract.pdf",
"claimtype":"Accident",
"modified_date":"2020-02-05T17:36:49.053Z",
"dob":"2020-02-05T17:36:49.053Z",
"client_address":"no,7 royal avenue thirumullaivoyal chennai"
}
In future for a single claim number there should be multiple URL's
So, how to handle this?
Not sure about Dynamo DB types. But in Elasticsearch there is no dedicated type for list. To store list of strings(URLs in your case) you can use keyword field type.
For example your data can be like
{
"id":"234561",
"policyholdername":"xxxxxx",
"age":"24",
"claimnumber":"234561",
"policynumber":"456784",
"url":["https://dgs-dms.s3.amazonaws.com/G-3114_Textract.pdf","https://foo/bar/foo.pdf"]
"claimtype":"Accident",
"modified_date":"2020-02-05T17:36:49.053Z",
"dob":"2020-02-05T17:36:49.053Z",
"client_address":"no,7 royal avenue thirumullaivoyal chennai"
}
and the equivalent elasticsearch mapping could be
{
"mappings": {
"_doc": {
"properties": {
"url": {
"type": "keyword"
}
}
}
}
}
and the search query can be
POST index/_search
{
"query": {
"term": {
"url": "https://foo/bar/foo.pdf"
}
}
}
I am new to elastic search and I have to do filter based on following condition.
Filter:
FirstName :
Abc
noName
My schema looks like below:
{
Id:123,
Name:{
FirstName:"abc",
LastName:"xyz"
}
},
{
Id:1234
},
{
Id:1235,
Name:{
FirstName:"yuiy",
LastName:"poi"
}
}
Some of mine data has Name model added but some of them does not. And I want to filter a data based on FirstName should be "Abc" or Name Field should not exist.
So if i filter using above filter criteria it should give me 123 and 1234 Ids document result.
So how Can I write elastic search query for this? I am connecting using Nest with Asp.Net Mvc.
So if someone can provide me Nest query or Elastic Search query that would be helpful.