Comments (19)
You're right it's missing. Let's add it. Do you want to take it up or do you want me to do it ?
from elastic4s.
Either way. If I take a shot, it would be helpful if you could point me in the right direction first. I'm not a complete Scala newbie, but not too far from it. It'd probably be late this week before I have a chance to work on it.
from elastic4s.
Ok I'll do some stuff and get your feedback.
from elastic4s.
Awesome. Thank you!
from elastic4s.
Integration with third-party JSON libraries such as json4s, play-json, spray-json or etc. will allow indexing/querying arbitrary case classes as well as common collections. Here's an example from redisreact.
from elastic4s.
But in our case something more is needed to match them to ES schema...
from elastic4s.
I think he means creating a mapping. I think using dot notation would suffice?
from elastic4s.
Oops... my bad, had too little sleep at that time.
from elastic4s.
Instead of using dot notation, ability to use nested mappings makes more sense to me.
client.execute {
create index "places" mappings (
"cities" as (
field("id") typed IntegerType,
field("name") boost 4,
field("content") analyzer StopAnalyzer
nested("stats") as (
field("population") typed IntegerType,
field("elavation") typed IntegerType
)
)
)
}
from elastic4s.
Right, might be nicer though if the word field could be retained, eg
client.execute {
create index "places" mappings (
"cities" as (
field("id") typed IntegerType,
field("name") boost 4,
field("content") analyzer StopAnalyzer
field("stats") as (
field("population") typed IntegerType,
field("elavation") typed IntegerType
)
)
)
}
from elastic4s.
Or actually, field could be updated to accept a new "mapping" defintion, which can be recursive, so you could do this
client.execute {
create index "places" mappings (
"cities" as (
field("id") typed IntegerType,
field("name") boost 4,
field("content") analyzer StopAnalyzer
"stats" as (
field("population") typed IntegerType,
field("elavation") typed IntegerType
)
)
)
}
Ie the "stats" part is actually an instance of the same object as "cities" is. Just forms a tree of definitions.
from elastic4s.
Yep, I was actually thinking of the same in terms of implementation. And your syntax looks pretty awesome.
from elastic4s.
@sksamuel Looks good to me as well.
from elastic4s.
Great, we all seem happy :)
from elastic4s.
Hi, I'm giving elastic4s a try for the next version of http://scalex.org and so far it looks promising. Nested mapping, indeed, would be a must. Cheers!
from elastic4s.
It's in progress ATM :)
from elastic4s.
There was a little issue with implicits. This is what I ended up with :
create.index("users").shards(2).mappings(
"tweets" as(
id typed StringType analyzer KeywordAnalyzer,
"name" typed StringType analyzer KeywordAnalyzer,
"locations" typed GeoPointType analyzer SimpleAnalyzer boost 4,
"date" typed DateType,
"content" typed StringType,
"user" nested(
"name" typed StringType,
"email" typed StringType,
"last" nested {
"lastLogin" typed DateType
}
)
) size true numericDetection true boostNullValue 1.2 boost "myboost"
)
This is currently in master.
from elastic4s.
It looks wonderful. Thank you.
from elastic4s.
Please don't put this onto an related, closed, ticket. Create a new ticket if there is a bug, or even better, ask a question at stack overflow using the tag elastic4s and I'll answer it there (and add more details, as its probably what you doing around the request that is the error).
from elastic4s.
Related Issues (20)
- Multisearch ignores memory circuit breaker errors HOT 1
- Update to cats-effect 3.5+
- Add runtime fields support to `MappingDefinitionLike` HOT 2
- Implement ScriptScoreQuery HOT 2
- opensearch compatibility HOT 9
- Add support for PIT in search
- ElasticProperties accepts invalid input and runs with only single node HOT 1
- [Force merge index] Can not force merge asynchronously
- WAND optimization with a numeric track_total_hits parameter
- Using REST API compatibility
- Support for highlights in TopHitsAggregation
- Elasticsearch server version for tests is not up-to-date and tests are failing when updating HOT 2
- SearchHit.sourceAsString adds superfluous type metadata HOT 2
- IndicesExistsRequest with allowNoIndices = true always returns true HOT 1
- `getIndex` doesn't support date math in index aliases HOT 1
- `indexExists` always returns `true` if index string contains `*` HOT 2
- `.sourceExclude` and `.sourceInclude` are mutually exclusive HOT 1
- docAsUpsert not working as expected
- ElasticSource does not clear it's scroll HOT 1
- Add Synonyms API support HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elastic4s.