How to create a _analyzer mapping using NEST client API for elastic search to allow document field property as analyzer as in ES documentation here:
http://www.elasticsearch.org/guide/reference/mapping/analyzer-field/
Thanks in advance. I might have missed this in
NEST documentation.
The mapping documentation on http://nest.azurewebsites.net is a bit behind.
Have a look at this unit test: https://github.com/Mpdreamz/NEST/blob/master/src/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs
For a full example of the mapping API.
Related
I have a spring boot application using spring data rest. I have a problem in providing a well read API documentation using swagger. I tried spring fox and springdoc, but each has its problems
Spring fox:
I can not change the tag name of a repository, only the description
No support for projections
No support of openAPI3 yet (this is actually not a big problem)
Springdoc (https://springdoc.org/)
I can not change neither the tag name nor the description (#Tag does not work on repos)
No support for projections
The same repo gets 3 tags e.g. books-entity-controller, books-search-controller (with methods of a parent class) and books-property-reference-controller (with unnecessary listing of /{id}/{property} urls)
Any better way? I like spring fox for not providing more than one tag, also the auto generated tag names are better e.g. Books Entity instead of books-entity-controller. But it would be better either to customize it or find a better alternative.
I recommand Spring REST Docs over Swagger. Spring REST Docs is test-driven to guarantee your API documentation is always sync with your API.
Andy's talk explains more why Spring REST Docs is more suitable than Swagger for API documentation.
You can find offical simple guide and more samples.
My Github project uses it. You can clone the repository and have a look at the generated documentation HTML /sga-booking/index.html.
Related Spring REST Docs file are
FltApiDocumentation.java
flts.adoc
BookingApiDocumentation.java
booking.adoc
If you find my Github useful, consider give it a star.
Springdoc
I can not change neither the tag name nor the description (#Tag does not work on repos)
and
The same repo gets 3 tags
You can customize it. Use the following at the controller-class level.
#Tag(name = "Name of the Tag", description = "Description of the tag")
or
#Tags(value = {
// Multiple #Tag annotations separated by comma ,
})
or the following at the method level.
#Operation(tags = {"Tag 1", "Tag 2"})
Remember:
#Tag at a class level will override the operation level tags for the particular class.
A class level tag can have only 1 value.
So if you need a controller to have multiple tags, you should isolate it in a different class that doesn't have the #Tag at the class level.
No support for projections
I have never used projections. I generally use the #JsonIgnore to eliminate the ones not needed, but depends on your use-case.
If you want to hide something from a schema, use can use the below method
#Schema(description = "Example POJO to demonstrate the hidden attribute")
class Example {
...
#Schema(hidden = true) // <--- Will be hidden from the Swagger UI completely
String exampleId;
...
}
Hope that helps. Drop a comment for any clarification.
I can see in the Basic Tutorial section of the odata website that you can perfom a contains search using a filter
GET serviceRoot/Airports?$filter=contains(Location/Address, 'San Francisco')
The API I am using refused this when I tried to use it. The API I am accessing is OData 2.0.
So I wanted to know if OData 2.0 supports the contains filter but couldn't find a list anywhere documenting the filters you could use e.g. startsWith, endsWith, contains
My research led me to the only answer I could find which was to use substringof instead of contains. This is the end of the url call from the actual API I am working on. This results in searching for Items filtered by Description containing "69":
/logistics/Items?$filter=substringof('69',%20Description)%20eq%20true
I wonder if it's possible to use custom metadata within the result of OData queries (at the entity level). I think of metadata such as scores since the query executed on an ElasticSearch database and I would like to provide these hints to the end user.
Thanks very much for your help!
Thierry
Sorry I'm not familiar with ElasticSearch. But if I understand your questions correctly, you want some information other than the raw data in the request result ? If so, there is such things called Instance Annotation that may satisfy your need. An explanation from OData spec.
HTH
As far as I can tell from the documentation and ReadMe for the gmaps4rails gem, you need to a model to set as acts_as_gmappable in order to use this wrapper.
In my case I am using simple a form_tag and text_field_tag elements in order to gather the addresses I want to display, and then I want to pass it through the wrapper in order to render the Google Map. I am not storing this gathered data in a database or model.
My questions are:
Can this be done with gmaps4rails? If yes can you direct me to an example of a model-less use case or give me any tips on how to do this?
If it can't be done with gmaps4rails, is there another gem/wrapper that would work? (I eventually want to show routes and directions)
I understand that I can use the original Google Maps JS V3 API, however I'm trying to keep it in Rails if possible because I'm a total newbie (business guy that decided to learn Rails and make a proto himself in order to attract a tech co-founder) and it seems like it'd be easier to use a wrapper than try to integrate with the API.
Thank you in advance for your help!
You could do this with gmaps4rails.
No need for acts_as_gmappable which is meant to geocode addresses.
Simply provide the view with something like:
#markers_json = [{lat: , lng:, description: }, {lat: , lng:, description: }].to_json
description will be displayed in infowindow.
I've read the documentation, but what I need to know is:
I'm not using a fictitious stock quote service (with an imaginary wsdl file). I'm using a different service with a different name.
Where, among the thousands and thousands of lines of code that have been generated, will I find the Scala trait(s) that I need to put together that correspond to this line in the documentation's example:
val service = (new stockquote.StockQuoteSoap12Bindings with scalaxb.SoapClients with scalaxb.DispatchHttpClients {}).service
Now, you might be thinking "Why not just search for Soap12Bindings in the generated code"? Good idea - but that turns up 0 results.
The example in the documentation is outdated, or too specific. (The documentation is also internally inconsistent and inconsistent with the actual filenames output with scalaxb.)
First, search for SoapBindings instead of Soap12Bindings to find the service-specific trait (the first trait).
Then, instead of scalaxb.SoapClients, use scalaxb.Soap11Clients.